aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gm/bigrrectaaeffect.cpp27
-rw-r--r--gm/constcolorprocessor.cpp27
-rw-r--r--gm/rrects.cpp23
-rw-r--r--gm/texturedomaineffect.cpp20
-rw-r--r--gm/yuvtorgbeffect.cpp21
-rw-r--r--src/gpu/GrDrawContext.cpp62
-rw-r--r--src/gpu/GrDrawTarget.cpp21
-rw-r--r--src/gpu/GrDrawTarget.h12
-rw-r--r--src/gpu/GrOvalRenderer.cpp5
-rw-r--r--src/gpu/GrSWMaskHelper.cpp9
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp20
-rw-r--r--src/gpu/GrTest.h3
-rw-r--r--src/gpu/batches/GrDefaultPathRenderer.cpp6
-rw-r--r--src/gpu/batches/GrStencilAndCoverPathRenderer.cpp7
14 files changed, 127 insertions, 136 deletions
diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp
index c3f47f932d..fde636071b 100644
--- a/gm/bigrrectaaeffect.cpp
+++ b/gm/bigrrectaaeffect.cpp
@@ -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;
diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp
index 3b2605e7a3..a9cd4b5dc5 100644
--- a/gm/constcolorprocessor.cpp
+++ b/gm/constcolorprocessor.cpp
@@ -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.
diff --git a/gm/rrects.cpp b/gm/rrects.cpp
index 938d4706dc..8cb737b21c 100644
--- a/gm/rrects.cpp
+++ b/gm/rrects.cpp
@@ -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;
}
diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp
index 3eaba90806..53316f7234 100644
--- a/gm/texturedomaineffect.cpp
+++ b/gm/texturedomaineffect.cpp
@@ -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;
diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp
index 66ade25184..18d799c3f7 100644
--- a/gm/yuvtorgbeffect.cpp
+++ b/gm/yuvtorgbeffect.cpp
@@ -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;
}
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index c471dca1be..6161626501 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -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,
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index bae4cabaae..0389d92f48 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -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,
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 72ab46e934..e64df28ad7 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -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,
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 3862900d4c..6cb203c05a 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -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;
}
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index 6692e3d833..34e4495286 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -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);
}
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index a136886a64..28a4b9ccfe 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -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);
}
}
diff --git a/src/gpu/GrTest.h b/src/gpu/GrTest.h
index 297f51c113..75eb53ac64 100644
--- a/src/gpu/GrTest.h
+++ b/src/gpu/GrTest.h
@@ -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 {
diff --git a/src/gpu/batches/GrDefaultPathRenderer.cpp b/src/gpu/batches/GrDefaultPathRenderer.cpp
index 638e03cb79..8ed3155a68 100644
--- a/src/gpu/batches/GrDefaultPathRenderer.cpp
+++ b/src/gpu/batches/GrDefaultPathRenderer.cpp
@@ -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();
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
index 848c82104d..6abe41e997 100644
--- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
@@ -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,