| Index: gm/beziereffects.cpp
|
| diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
|
| index 5167b770134b6023ea5dbd851a9ddc37a20f2364..ccee7163a4dc081e1d7d06a891ac734e51d55f1a 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,8 @@ protected:
|
| return;
|
| }
|
|
|
| + GrDrawContext* drawContext = context->drawContext(rt);
|
| +
|
| struct Vertex {
|
| SkPoint fPosition;
|
| float fKLM[4]; // The last value is ignored. The effect expects a vec4f.
|
| @@ -155,20 +158,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 +211,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 +223,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 +270,8 @@ protected:
|
| return;
|
| }
|
|
|
| + GrDrawContext* drawContext = context->drawContext(rt);
|
| +
|
| struct Vertex {
|
| SkPoint fPosition;
|
| float fKLM[4]; // The last value is ignored. The effect expects a vec4f.
|
| @@ -305,18 +298,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 +349,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 +361,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 +506,8 @@ protected:
|
| return;
|
| }
|
|
|
| + GrDrawContext* drawContext = context->drawContext(rt);
|
| +
|
| struct Vertex {
|
| SkPoint fPosition;
|
| float fUV[4]; // The last two values are ignored. The effect expects a vec4f.
|
| @@ -548,18 +532,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 +580,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 +594,7 @@ protected:
|
| SkAutoTUnref<GrDrawBatch> batch(BezierQuadTestBatch::Create(gp, geometry,
|
| DevToUV));
|
|
|
| - tt.target()->drawBatch(pipelineBuilder, batch);
|
| + drawContext->internal_drawBatch(&pipelineBuilder, batch);
|
| }
|
| ++col;
|
| if (numCols == col) {
|
|
|