Index: gm/beziereffects.cpp |
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp |
index 5167b770134b6023ea5dbd851a9ddc37a20f2364..2511dec6e025a9f9d7afe2ea79256e2e54a92e1e 100644 |
--- a/gm/beziereffects.cpp |
+++ b/gm/beziereffects.cpp |
@@ -12,6 +12,7 @@ |
#if SK_SUPPORT_GPU |
+#include "GrDrawContext.h" |
#include "GrContext.h" |
#include "GrPathUtils.h" |
#include "GrTest.h" |
@@ -129,6 +130,11 @@ protected: |
return; |
} |
+ SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt)); |
+ if (!drawContext) { |
+ return; |
+ } |
+ |
struct Vertex { |
SkPoint fPosition; |
float fKLM[4]; // The last value is ignored. The effect expects a vec4f. |
@@ -155,20 +161,12 @@ protected: |
}; |
for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType) { |
SkAutoTUnref<GrGeometryProcessor> gp; |
- { // scope to contain GrTestTarget |
- GrTestTarget tt; |
- context->getTestTarget(&tt, rt); |
- if (nullptr == tt.target()) { |
- continue; |
- } |
- GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
- gp.reset(GrCubicEffect::Create(color, SkMatrix::I(), et, |
- *tt.target()->caps())); |
- if (!gp) { |
- continue; |
- } |
+ GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
+ gp.reset(GrCubicEffect::Create(color, SkMatrix::I(), et, |
+ *context->caps())); |
+ if (!gp) { |
+ continue; |
} |
- |
SkScalar x = SkScalarMul(col, w); |
SkScalar y = SkScalarMul(row, h); |
SkPoint controlPts[] = { |
@@ -216,10 +214,6 @@ protected: |
boundsPaint.setStyle(SkPaint::kStroke_Style); |
canvas->drawRect(bounds, boundsPaint); |
- GrTestTarget tt; |
- context->getTestTarget(&tt, rt); |
- SkASSERT(tt.target()); |
- |
GrPipelineBuilder pipelineBuilder; |
pipelineBuilder.setXPFactory( |
GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); |
@@ -232,7 +226,7 @@ protected: |
SkAutoTUnref<GrDrawBatch> batch( |
BezierCubicOrConicTestBatch::Create(gp, geometry, klmEqs, klmSigns[c])); |
- tt.target()->drawBatch(pipelineBuilder, batch); |
+ drawContext->internal_drawBatch(pipelineBuilder, batch); |
} |
++col; |
if (numCols == col) { |
@@ -279,6 +273,11 @@ protected: |
return; |
} |
+ SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt)); |
+ if (!drawContext) { |
+ return; |
+ } |
+ |
struct Vertex { |
SkPoint fPosition; |
float fKLM[4]; // The last value is ignored. The effect expects a vec4f. |
@@ -305,18 +304,11 @@ protected: |
SkScalar weight = rand.nextRangeF(0.f, 2.f); |
for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType) { |
SkAutoTUnref<GrGeometryProcessor> gp; |
- { // scope to contain GrTestTarget |
- GrTestTarget tt; |
- context->getTestTarget(&tt, rt); |
- if (nullptr == tt.target()) { |
- continue; |
- } |
- GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
- gp.reset(GrConicEffect::Create(color, SkMatrix::I(), et, |
- *tt.target()->caps(), SkMatrix::I(), false)); |
- if (!gp) { |
- continue; |
- } |
+ GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
+ gp.reset(GrConicEffect::Create(color, SkMatrix::I(), et, |
+ *context->caps(), SkMatrix::I(), false)); |
+ if (!gp) { |
+ continue; |
} |
SkScalar x = SkScalarMul(col, w); |
@@ -363,10 +355,6 @@ protected: |
boundsPaint.setStyle(SkPaint::kStroke_Style); |
canvas->drawRect(bounds, boundsPaint); |
- GrTestTarget tt; |
- context->getTestTarget(&tt, rt); |
- SkASSERT(tt.target()); |
- |
GrPipelineBuilder pipelineBuilder; |
pipelineBuilder.setXPFactory( |
GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); |
@@ -379,7 +367,7 @@ protected: |
SkAutoTUnref<GrDrawBatch> batch( |
BezierCubicOrConicTestBatch::Create(gp, geometry, klmEqs, 1.f)); |
- tt.target()->drawBatch(pipelineBuilder, batch); |
+ drawContext->internal_drawBatch(pipelineBuilder, batch); |
} |
++col; |
if (numCols == col) { |
@@ -524,6 +512,11 @@ protected: |
return; |
} |
+ SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt)); |
+ if (!drawContext) { |
+ return; |
+ } |
+ |
struct Vertex { |
SkPoint fPosition; |
float fUV[4]; // The last two values are ignored. The effect expects a vec4f. |
@@ -548,18 +541,11 @@ protected: |
}; |
for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType) { |
SkAutoTUnref<GrGeometryProcessor> gp; |
- { // scope to contain GrTestTarget |
- GrTestTarget tt; |
- context->getTestTarget(&tt, rt); |
- if (nullptr == tt.target()) { |
- continue; |
- } |
- GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
- gp.reset(GrQuadEffect::Create(color, SkMatrix::I(), et, |
- *tt.target()->caps(), SkMatrix::I(), false)); |
- if (!gp) { |
- continue; |
- } |
+ GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
+ gp.reset(GrQuadEffect::Create(color, SkMatrix::I(), et, |
+ *context->caps(), SkMatrix::I(), false)); |
+ if (!gp) { |
+ continue; |
} |
SkScalar x = SkScalarMul(col, w); |
@@ -603,10 +589,6 @@ protected: |
boundsPaint.setStyle(SkPaint::kStroke_Style); |
canvas->drawRect(bounds, boundsPaint); |
- GrTestTarget tt; |
- context->getTestTarget(&tt, rt); |
- SkASSERT(tt.target()); |
- |
GrPipelineBuilder pipelineBuilder; |
pipelineBuilder.setXPFactory( |
GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref(); |
@@ -621,7 +603,7 @@ protected: |
SkAutoTUnref<GrDrawBatch> batch(BezierQuadTestBatch::Create(gp, geometry, |
DevToUV)); |
- tt.target()->drawBatch(pipelineBuilder, batch); |
+ drawContext->internal_drawBatch(pipelineBuilder, batch); |
} |
++col; |
if (numCols == col) { |