Remove two varieties of drawNonAARect from GrDrawTarget
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1584703003 Review URL: https://codereview.chromium.org/1584703003
This commit is contained in:
parent
bb25b53249
commit
04194f32f4
@ -7,10 +7,14 @@
|
||||
|
||||
#include "gm.h"
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrTest.h"
|
||||
#include "effects/GrRRectEffect.h"
|
||||
#include "GrContext.h"
|
||||
#include "GrDrawContext.h"
|
||||
#include "GrPipelineBuilder.h"
|
||||
#include "SkDevice.h"
|
||||
#include "SkRRect.h"
|
||||
#include "batches/GrDrawBatch.h"
|
||||
#include "batches/GrRectBatchFactory.h"
|
||||
#include "effects/GrRRectEffect.h"
|
||||
|
||||
namespace skiagm {
|
||||
|
||||
@ -53,6 +57,11 @@ protected:
|
||||
return;
|
||||
}
|
||||
|
||||
SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt));
|
||||
if (!drawContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
SkPaint paint;
|
||||
|
||||
int y = kPad;
|
||||
@ -72,12 +81,6 @@ protected:
|
||||
paint.setColor(SK_ColorWHITE);
|
||||
canvas->drawRect(testBounds, paint);
|
||||
|
||||
GrTestTarget tt;
|
||||
context->getTestTarget(&tt, rt);
|
||||
if (!tt.target()) {
|
||||
SkDEBUGFAIL("Couldn't get Gr test target.");
|
||||
return;
|
||||
}
|
||||
GrPipelineBuilder pipelineBuilder;
|
||||
pipelineBuilder.setXPFactory(
|
||||
GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref();
|
||||
@ -93,10 +96,10 @@ protected:
|
||||
SkRect bounds = testBounds;
|
||||
bounds.offset(SkIntToScalar(x), SkIntToScalar(y));
|
||||
|
||||
tt.target()->drawNonAARect(pipelineBuilder,
|
||||
0xff000000,
|
||||
SkMatrix::I(),
|
||||
bounds);
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMatrix::I(), bounds,
|
||||
nullptr, nullptr));
|
||||
drawContext->internal_drawBatch(pipelineBuilder, batch);
|
||||
}
|
||||
canvas->restore();
|
||||
x = x + fTestOffsetX;
|
||||
|
@ -13,10 +13,13 @@
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
#include "GrContext.h"
|
||||
#include "GrTest.h"
|
||||
#include "effects/GrConstColorProcessor.h"
|
||||
#include "GrDrawContext.h"
|
||||
#include "GrPipelineBuilder.h"
|
||||
#include "SkGrPriv.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "batches/GrDrawBatch.h"
|
||||
#include "batches/GrRectBatchFactory.h"
|
||||
#include "effects/GrConstColorProcessor.h"
|
||||
|
||||
namespace skiagm {
|
||||
/**
|
||||
@ -55,6 +58,11 @@ protected:
|
||||
return;
|
||||
}
|
||||
|
||||
SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt));
|
||||
if (!drawContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
static const GrColor kColors[] = {
|
||||
0xFFFFFFFF,
|
||||
0xFFFF00FF,
|
||||
@ -90,13 +98,6 @@ protected:
|
||||
// rect to draw
|
||||
SkRect renderRect = SkRect::MakeXYWH(0, 0, kRectSize, kRectSize);
|
||||
|
||||
GrTestTarget tt;
|
||||
context->getTestTarget(&tt, rt);
|
||||
if (nullptr == tt.target()) {
|
||||
SkDEBUGFAIL("Couldn't get Gr test target.");
|
||||
return;
|
||||
}
|
||||
|
||||
GrPaint grPaint;
|
||||
SkPaint skPaint;
|
||||
if (paintType >= SK_ARRAY_COUNT(kPaintColors)) {
|
||||
@ -114,10 +115,10 @@ protected:
|
||||
GrPipelineBuilder pipelineBuilder(grPaint, rt, clip);
|
||||
pipelineBuilder.addColorFragmentProcessor(fp);
|
||||
|
||||
tt.target()->drawNonAARect(pipelineBuilder,
|
||||
grPaint.getColor(),
|
||||
viewMatrix,
|
||||
renderRect);
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(grPaint.getColor(), viewMatrix,
|
||||
renderRect, nullptr, nullptr));
|
||||
drawContext->internal_drawBatch(pipelineBuilder, batch);
|
||||
|
||||
// Draw labels for the input to the processor and the processor to the right of
|
||||
// the test rect. The input label appears above the processor label.
|
||||
|
@ -7,7 +7,10 @@
|
||||
|
||||
#include "gm.h"
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "GrTest.h"
|
||||
#include "GrContext.h"
|
||||
#include "GrDrawContext.h"
|
||||
#include "batches/GrDrawBatch.h"
|
||||
#include "batches/GrRectBatchFactory.h"
|
||||
#include "effects/GrRRectEffect.h"
|
||||
#endif
|
||||
#include "SkDevice.h"
|
||||
@ -64,6 +67,10 @@ protected:
|
||||
#if SK_SUPPORT_GPU
|
||||
GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget();
|
||||
context = rt ? rt->getContext() : nullptr;
|
||||
SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt));
|
||||
if (!drawContext) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (kEffect_Type == fType && nullptr == context) {
|
||||
skiagm::GM::DrawGpuOnlyMessage(canvas);
|
||||
@ -103,12 +110,6 @@ protected:
|
||||
canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
|
||||
if (kEffect_Type == fType) {
|
||||
#if SK_SUPPORT_GPU
|
||||
GrTestTarget tt;
|
||||
context->getTestTarget(&tt, rt);
|
||||
if (nullptr == tt.target()) {
|
||||
SkDEBUGFAIL("Couldn't get Gr test target.");
|
||||
return;
|
||||
}
|
||||
GrPipelineBuilder pipelineBuilder;
|
||||
pipelineBuilder.setXPFactory(
|
||||
GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref();
|
||||
@ -125,10 +126,10 @@ protected:
|
||||
SkRect bounds = rrect.getBounds();
|
||||
bounds.outset(2.f, 2.f);
|
||||
|
||||
tt.target()->drawNonAARect(pipelineBuilder,
|
||||
0xff000000,
|
||||
SkMatrix::I(),
|
||||
bounds);
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMatrix::I(),
|
||||
bounds, nullptr, nullptr));
|
||||
drawContext->internal_drawBatch(pipelineBuilder, batch);
|
||||
} else {
|
||||
drew = false;
|
||||
}
|
||||
|
@ -12,12 +12,14 @@
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
#include "GrDrawContext.h"
|
||||
#include "GrContext.h"
|
||||
#include "GrTest.h"
|
||||
#include "effects/GrTextureDomain.h"
|
||||
#include "SkBitmap.h"
|
||||
#include "SkGr.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "batches/GrDrawBatch.h"
|
||||
#include "batches/GrRectBatchFactory.h"
|
||||
#include "effects/GrTextureDomain.h"
|
||||
|
||||
namespace skiagm {
|
||||
/**
|
||||
@ -79,10 +81,8 @@ protected:
|
||||
return;
|
||||
}
|
||||
|
||||
GrTestTarget tt;
|
||||
context->getTestTarget(&tt, rt);
|
||||
if (nullptr == tt.target()) {
|
||||
SkDEBUGFAIL("Couldn't get Gr test target.");
|
||||
SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt));
|
||||
if (!drawContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -132,10 +132,10 @@ protected:
|
||||
pipelineBuilder.setRenderTarget(rt);
|
||||
pipelineBuilder.addColorFragmentProcessor(fp);
|
||||
|
||||
tt.target()->drawNonAARect(pipelineBuilder,
|
||||
GrColor_WHITE,
|
||||
viewMatrix,
|
||||
renderRect);
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix,
|
||||
renderRect, nullptr, nullptr));
|
||||
drawContext->internal_drawBatch(pipelineBuilder, batch);
|
||||
x += renderRect.width() + kTestPad;
|
||||
}
|
||||
y += renderRect.height() + kTestPad;
|
||||
|
@ -13,11 +13,14 @@
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
#include "GrContext.h"
|
||||
#include "GrTest.h"
|
||||
#include "effects/GrYUVtoRGBEffect.h"
|
||||
#include "GrDrawContext.h"
|
||||
#include "GrPipelineBuilder.h"
|
||||
#include "SkBitmap.h"
|
||||
#include "SkGr.h"
|
||||
#include "SkGradientShader.h"
|
||||
#include "batches/GrDrawBatch.h"
|
||||
#include "batches/GrRectBatchFactory.h"
|
||||
#include "effects/GrYUVtoRGBEffect.h"
|
||||
|
||||
#define YSIZE 8
|
||||
#define USIZE 4
|
||||
@ -77,10 +80,8 @@ protected:
|
||||
return;
|
||||
}
|
||||
|
||||
GrTestTarget tt;
|
||||
context->getTestTarget(&tt, rt);
|
||||
if (nullptr == tt.target()) {
|
||||
SkDEBUGFAIL("Couldn't get Gr test target.");
|
||||
SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt));
|
||||
if (!drawContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -128,10 +129,10 @@ protected:
|
||||
viewMatrix.setTranslate(x, y);
|
||||
pipelineBuilder.setRenderTarget(rt);
|
||||
pipelineBuilder.addColorFragmentProcessor(fp);
|
||||
tt.target()->drawNonAARect(pipelineBuilder,
|
||||
GrColor_WHITE,
|
||||
viewMatrix,
|
||||
renderRect);
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix,
|
||||
renderRect, nullptr, nullptr));
|
||||
drawContext->internal_drawBatch(pipelineBuilder, batch);
|
||||
}
|
||||
x += renderRect.width() + kTestPad;
|
||||
}
|
||||
|
@ -225,11 +225,10 @@ void GrDrawContext::drawPaint(const GrClip& clip,
|
||||
AutoCheckFlush acf(fDrawingManager);
|
||||
|
||||
GrPipelineBuilder pipelineBuilder(*paint, fRenderTarget, clip);
|
||||
this->getDrawTarget()->drawNonAARect(pipelineBuilder,
|
||||
paint->getColor(),
|
||||
SkMatrix::I(),
|
||||
r,
|
||||
localMatrix);
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(paint->getColor(), SkMatrix::I(), r, nullptr,
|
||||
&localMatrix));
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,8 +299,8 @@ void GrDrawContext::drawRect(const GrClip& clip,
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip);
|
||||
GrColor color = paint.getColor();
|
||||
|
||||
SkAutoTUnref<GrDrawBatch> batch;
|
||||
if (should_apply_coverage_aa(paint, fRenderTarget)) {
|
||||
SkAutoTUnref<GrDrawBatch> batch;
|
||||
if (width >= 0) {
|
||||
// The stroke path needs the rect to remain axis aligned (no rotation or skew).
|
||||
if (viewMatrix.rectStaysRect()) {
|
||||
@ -317,34 +316,30 @@ void GrDrawContext::drawRect(const GrClip& clip,
|
||||
devBoundRect));
|
||||
}
|
||||
}
|
||||
if (batch) {
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
} else {
|
||||
if (!batch) {
|
||||
SkPath path;
|
||||
path.setIsVolatile(true);
|
||||
path.addRect(rect);
|
||||
this->internalDrawPath(&pipelineBuilder, viewMatrix, color, true, path, *strokeInfo);
|
||||
SkASSERT(paint.isAntiAlias());
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (width >= 0) {
|
||||
} else if (width >= 0) {
|
||||
// Non-AA hairlines are snapped to pixel centers to make which pixels are hit deterministic
|
||||
bool snapToPixelCenters = (0 == width && !fRenderTarget->isUnifiedMultisampled());
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAStroke(
|
||||
color, viewMatrix, rect, width, snapToPixelCenters));
|
||||
batch.reset(GrRectBatchFactory::CreateNonAAStroke(color, viewMatrix, rect, width,
|
||||
snapToPixelCenters));
|
||||
|
||||
// Depending on sub-pixel coordinates and the particular GPU, we may lose a corner of
|
||||
// hairline rects. We jam all the vertices to pixel centers to avoid this, but not when MSAA
|
||||
// is enabled because it can cause ugly artifacts.
|
||||
pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_Flag,
|
||||
snapToPixelCenters);
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
} else {
|
||||
// filled BW rect
|
||||
this->getDrawTarget()->drawNonAARect(pipelineBuilder, color, viewMatrix, rect);
|
||||
batch.reset(GrRectBatchFactory::CreateNonAAFill(color, viewMatrix, rect, nullptr, nullptr));
|
||||
}
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
}
|
||||
|
||||
void GrDrawContext::fillRectToRect(const GrClip& clip,
|
||||
@ -360,19 +355,18 @@ void GrDrawContext::fillRectToRect(const GrClip& clip,
|
||||
AutoCheckFlush acf(fDrawingManager);
|
||||
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip);
|
||||
SkAutoTUnref<GrDrawBatch> batch;
|
||||
if (should_apply_coverage_aa(paint, fRenderTarget) &&
|
||||
view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrAAFillRectBatch::CreateWithLocalRect(
|
||||
paint.getColor(), viewMatrix, rectToDraw, localRect));
|
||||
if (batch) {
|
||||
this->drawBatch(&pipelineBuilder, batch);
|
||||
}
|
||||
batch.reset(GrAAFillRectBatch::CreateWithLocalRect(paint.getColor(), viewMatrix, rectToDraw,
|
||||
localRect));
|
||||
} else {
|
||||
this->getDrawTarget()->drawNonAARect(pipelineBuilder,
|
||||
paint.getColor(),
|
||||
viewMatrix,
|
||||
rectToDraw,
|
||||
localRect);
|
||||
batch.reset(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix, rectToDraw,
|
||||
&localRect, nullptr));
|
||||
}
|
||||
|
||||
if (batch) {
|
||||
this->drawBatch(&pipelineBuilder, batch);
|
||||
}
|
||||
}
|
||||
|
||||
@ -390,18 +384,16 @@ void GrDrawContext::fillRectWithLocalMatrix(const GrClip& clip,
|
||||
|
||||
GrPipelineBuilder pipelineBuilder(paint, fRenderTarget, clip);
|
||||
|
||||
SkAutoTUnref<GrDrawBatch> batch;
|
||||
if (should_apply_coverage_aa(paint, fRenderTarget) &&
|
||||
view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrAAFillRectBatch::Create(
|
||||
paint.getColor(), viewMatrix, localMatrix, rectToDraw));
|
||||
this->drawBatch(&pipelineBuilder, batch);
|
||||
batch.reset(GrAAFillRectBatch::Create(paint.getColor(), viewMatrix, localMatrix,
|
||||
rectToDraw));
|
||||
} else {
|
||||
this->getDrawTarget()->drawNonAARect(pipelineBuilder,
|
||||
paint.getColor(),
|
||||
viewMatrix,
|
||||
rectToDraw,
|
||||
localMatrix);
|
||||
batch.reset(GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewMatrix, rectToDraw,
|
||||
nullptr, &localMatrix));
|
||||
}
|
||||
this->getDrawTarget()->drawBatch(pipelineBuilder, batch);
|
||||
}
|
||||
|
||||
void GrDrawContext::drawVertices(const GrClip& clip,
|
||||
|
@ -359,27 +359,6 @@ void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder,
|
||||
this->drawBatch(pipelineBuilder, batch);
|
||||
}
|
||||
|
||||
void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect& rect,
|
||||
const SkMatrix& localMatrix) {
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, viewMatrix, rect,
|
||||
nullptr, &localMatrix));
|
||||
this->drawBatch(pipelineBuilder, batch);
|
||||
}
|
||||
|
||||
void GrDrawTarget::drawNonAARect(const GrPipelineBuilder& pipelineBuilder,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect& rect,
|
||||
const SkRect& localRect) {
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, viewMatrix, rect,
|
||||
&localRect, nullptr));
|
||||
this->drawBatch(pipelineBuilder, batch);
|
||||
}
|
||||
|
||||
|
||||
void GrDrawTarget::drawAARect(const GrPipelineBuilder& pipelineBuilder,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
|
@ -137,18 +137,6 @@ public:
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect& rect);
|
||||
|
||||
void drawNonAARect(const GrPipelineBuilder& pipelineBuilder,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect& rect,
|
||||
const SkMatrix& localMatrix);
|
||||
|
||||
void drawNonAARect(const GrPipelineBuilder& pipelineBuilder,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect& rect,
|
||||
const SkRect& localRect);
|
||||
|
||||
void drawNonAARect(const GrPipelineBuilder& ds,
|
||||
GrColor color,
|
||||
const SkMatrix& viewM,
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "SkRRect.h"
|
||||
#include "SkStrokeRec.h"
|
||||
#include "SkTLazy.h"
|
||||
#include "batches/GrRectBatchFactory.h"
|
||||
#include "batches/GrVertexBatch.h"
|
||||
#include "effects/GrRRectEffect.h"
|
||||
#include "glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
@ -1493,7 +1494,9 @@ bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target,
|
||||
if (applyAA) {
|
||||
bounds.outset(SK_ScalarHalf, SK_ScalarHalf);
|
||||
}
|
||||
target->drawNonAARect(pipelineBuilder, color, SkMatrix::I(), bounds, invert);
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, SkMatrix::I(),
|
||||
bounds, nullptr, &invert));
|
||||
target->drawBatch(pipelineBuilder, batch);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -7,17 +7,16 @@
|
||||
|
||||
#include "GrSWMaskHelper.h"
|
||||
|
||||
#include "GrPipelineBuilder.h"
|
||||
#include "GrCaps.h"
|
||||
#include "GrDrawTarget.h"
|
||||
#include "GrGpu.h"
|
||||
#include "GrPipelineBuilder.h"
|
||||
|
||||
#include "SkData.h"
|
||||
#include "SkDistanceFieldGen.h"
|
||||
#include "SkStrokeRec.h"
|
||||
|
||||
// TODO: try to remove this #include
|
||||
#include "GrContext.h"
|
||||
#include "batches/GrRectBatchFactory.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -372,5 +371,7 @@ void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
|
||||
GrTextureParams::kNone_FilterMode,
|
||||
kDevice_GrCoordSet))->unref();
|
||||
|
||||
target->drawNonAARect(*pipelineBuilder, color, SkMatrix::I(), dstRect, invert);
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, SkMatrix::I(),
|
||||
dstRect, nullptr, &invert));
|
||||
target->drawBatch(*pipelineBuilder, batch);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "GrContext.h"
|
||||
#include "GrSWMaskHelper.h"
|
||||
#include "GrVertexBuffer.h"
|
||||
#include "batches/GrRectBatchFactory.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool GrSoftwarePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
|
||||
@ -65,6 +66,17 @@ bool get_path_and_clip_bounds(const GrPipelineBuilder* pipelineBuilder,
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static void draw_non_aa_rect(GrDrawTarget* drawTarget,
|
||||
const GrPipelineBuilder& pipelineBuilder,
|
||||
GrColor color,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkRect& rect,
|
||||
const SkMatrix& localMatrix) {
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, viewMatrix, rect,
|
||||
nullptr, &localMatrix));
|
||||
drawTarget->drawBatch(pipelineBuilder, batch);
|
||||
}
|
||||
|
||||
void draw_around_inv_path(GrDrawTarget* target,
|
||||
GrPipelineBuilder* pipelineBuilder,
|
||||
GrColor color,
|
||||
@ -80,22 +92,22 @@ void draw_around_inv_path(GrDrawTarget* target,
|
||||
if (devClipBounds.fTop < devPathBounds.fTop) {
|
||||
rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
|
||||
devClipBounds.fRight, devPathBounds.fTop);
|
||||
target->drawNonAARect(*pipelineBuilder, color, SkMatrix::I(), rect, invert);
|
||||
draw_non_aa_rect(target, *pipelineBuilder, color, SkMatrix::I(), rect, invert);
|
||||
}
|
||||
if (devClipBounds.fLeft < devPathBounds.fLeft) {
|
||||
rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
|
||||
devPathBounds.fLeft, devPathBounds.fBottom);
|
||||
target->drawNonAARect(*pipelineBuilder, color, SkMatrix::I(), rect, invert);
|
||||
draw_non_aa_rect(target, *pipelineBuilder, color, SkMatrix::I(), rect, invert);
|
||||
}
|
||||
if (devClipBounds.fRight > devPathBounds.fRight) {
|
||||
rect.iset(devPathBounds.fRight, devPathBounds.fTop,
|
||||
devClipBounds.fRight, devPathBounds.fBottom);
|
||||
target->drawNonAARect(*pipelineBuilder, color, SkMatrix::I(), rect, invert);
|
||||
draw_non_aa_rect(target, *pipelineBuilder, color, SkMatrix::I(), rect, invert);
|
||||
}
|
||||
if (devClipBounds.fBottom > devPathBounds.fBottom) {
|
||||
rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
|
||||
devClipBounds.fRight, devClipBounds.fBottom);
|
||||
target->drawNonAARect(*pipelineBuilder, color, SkMatrix::I(), rect, invert);
|
||||
draw_non_aa_rect(target, *pipelineBuilder, color, SkMatrix::I(), rect, invert);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,8 @@ namespace GrTest {
|
||||
void SetupAlwaysEvictAtlas(GrContext*);
|
||||
};
|
||||
|
||||
/** Allows a test to temporarily draw to a GrDrawTarget owned by a GrContext. Tests that use this
|
||||
/** TODO Please do not use this if you can avoid it. We are in the process of deleting it.
|
||||
Allows a test to temporarily draw to a GrDrawTarget owned by a GrContext. Tests that use this
|
||||
should be careful not to mix using the GrDrawTarget directly and drawing via SkCanvas or
|
||||
GrContext. In the future this object may provide some guards to prevent this. */
|
||||
class GrTestTarget {
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "SkTLazy.h"
|
||||
#include "SkTraceEvent.h"
|
||||
|
||||
#include "batches/GrRectBatchFactory.h"
|
||||
#include "batches/GrVertexBatch.h"
|
||||
|
||||
GrDefaultPathRenderer::GrDefaultPathRenderer(bool separateStencilSupport,
|
||||
@ -697,7 +698,10 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
|
||||
}
|
||||
const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() :
|
||||
viewMatrix;
|
||||
target->drawNonAARect(*pipelineBuilder, color, viewM, bounds, localMatrix);
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(color, viewM, bounds, nullptr,
|
||||
&localMatrix));
|
||||
target->drawBatch(*pipelineBuilder, batch);
|
||||
} else {
|
||||
if (passCount > 1) {
|
||||
pipelineBuilder->setDisableColorXPFactory();
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "GrRenderTarget.h"
|
||||
#include "GrResourceProvider.h"
|
||||
#include "GrStrokeInfo.h"
|
||||
#include "batches/GrRectBatchFactory.h"
|
||||
|
||||
GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrResourceProvider* resourceProvider,
|
||||
const GrCaps& caps) {
|
||||
@ -121,7 +122,11 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
if (pipelineBuilder->getRenderTarget()->hasMixedSamples()) {
|
||||
pipelineBuilder->disableState(GrPipelineBuilder::kHWAntialias_Flag);
|
||||
}
|
||||
args.fTarget->drawNonAARect(*pipelineBuilder, args.fColor, viewM, bounds, invert);
|
||||
|
||||
SkAutoTUnref<GrDrawBatch> batch(
|
||||
GrRectBatchFactory::CreateNonAAFill(args.fColor, viewM, bounds, nullptr,
|
||||
&invert));
|
||||
args.fTarget->drawBatch(*pipelineBuilder, batch);
|
||||
} else {
|
||||
GR_STATIC_CONST_SAME_STENCIL(kStencilPass,
|
||||
kZero_StencilOp,
|
||||
|
Loading…
Reference in New Issue
Block a user