diff options
author | robertphillips <robertphillips@google.com> | 2016-06-23 14:07:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-23 14:07:00 -0700 |
commit | 28a838e532250fcca9673aca6c4616193a5a139d (patch) | |
tree | 3554ad76c7ce5f69d7ab200b3f2c52ba955827e0 /gm | |
parent | b593a76749c6c7e12bf86aeaa06e1e52708e9bdf (diff) |
Move GrPipelineBuilder out of gms & reduce use of GrPipelineBuilder.h
Just another step in reining in the GrPLB
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2086293006
Review-Url: https://codereview.chromium.org/2086293006
Diffstat (limited to 'gm')
-rw-r--r-- | gm/beziereffects.cpp | 21 | ||||
-rw-r--r-- | gm/bigrrectaaeffect.cpp | 9 | ||||
-rw-r--r-- | gm/constcolorprocessor.cpp | 6 | ||||
-rw-r--r-- | gm/convexpolyeffect.cpp | 16 | ||||
-rw-r--r-- | gm/dcshader.cpp | 1 | ||||
-rw-r--r-- | gm/rrects.cpp | 10 | ||||
-rw-r--r-- | gm/texturedomaineffect.cpp | 9 | ||||
-rw-r--r-- | gm/yuvtorgbeffect.cpp | 17 |
8 files changed, 40 insertions, 49 deletions
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp index ae1c37fdf6..0c568d09f5 100644 --- a/gm/beziereffects.cpp +++ b/gm/beziereffects.cpp @@ -188,14 +188,13 @@ protected: boundsPaint.setStyle(SkPaint::kStroke_Style); canvas->drawRect(bounds, boundsPaint); - GrPipelineBuilder pipelineBuilder; - pipelineBuilder.setXPFactory( - GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); + GrPaint grPaint; + grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); SkAutoTUnref<GrDrawBatch> batch( new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, klmSigns[c])); - drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBuilder, batch); + drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch); } ++col; if (numCols == col) { @@ -320,14 +319,13 @@ protected: boundsPaint.setStyle(SkPaint::kStroke_Style); canvas->drawRect(bounds, boundsPaint); - GrPipelineBuilder pipelineBuilder; - pipelineBuilder.setXPFactory( - GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); + GrPaint grPaint; + grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); SkAutoTUnref<GrDrawBatch> batch( new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, 1.f)); - drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBuilder, batch); + drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch); } ++col; if (numCols == col) { @@ -527,16 +525,15 @@ protected: boundsPaint.setStyle(SkPaint::kStroke_Style); canvas->drawRect(bounds, boundsPaint); - GrPipelineBuilder pipelineBuilder; - pipelineBuilder.setXPFactory( - GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); + GrPaint grPaint; + grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); GrPathUtils::QuadUVMatrix DevToUV(pts); SkAutoTUnref<GrDrawBatch> batch( new BezierQuadTestBatch(gp, bounds, color, DevToUV)); - drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBuilder, batch); + drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch); } ++col; if (numCols == col) { diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp index 924704a5ac..7f79a34c6b 100644 --- a/gm/bigrrectaaeffect.cpp +++ b/gm/bigrrectaaeffect.cpp @@ -9,7 +9,6 @@ #if SK_SUPPORT_GPU #include "GrContext.h" #include "GrDrawContextPriv.h" -#include "GrPipelineBuilder.h" #include "SkRRect.h" #include "batches/GrDrawBatch.h" #include "batches/GrRectBatchFactory.h" @@ -74,15 +73,15 @@ protected: paint.setColor(SK_ColorWHITE); canvas->drawRect(testBounds, paint); - GrPipelineBuilder pipelineBuilder; - pipelineBuilder.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); + GrPaint grPaint; + grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); SkRRect rrect = fRRect; rrect.offset(SkIntToScalar(x + kGap), SkIntToScalar(y + kGap)); sk_sp<GrFragmentProcessor> fp(GrRRectEffect::Make(edgeType, rrect)); SkASSERT(fp); if (fp) { - pipelineBuilder.addCoverageFragmentProcessor(std::move(fp)); + grPaint.addCoverageFragmentProcessor(std::move(fp)); SkRect bounds = testBounds; bounds.offset(SkIntToScalar(x), SkIntToScalar(y)); @@ -90,7 +89,7 @@ protected: SkAutoTUnref<GrDrawBatch> batch( GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMatrix::I(), bounds, nullptr, nullptr)); - drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBuilder, batch); + drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch); } canvas->restore(); x = x + fTestOffsetX; diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp index 8ae93a4ae9..32d03a0c02 100644 --- a/gm/constcolorprocessor.cpp +++ b/gm/constcolorprocessor.cpp @@ -13,7 +13,6 @@ #include "GrContext.h" #include "GrDrawContextPriv.h" -#include "GrPipelineBuilder.h" #include "SkGrPriv.h" #include "SkGradientShader.h" #include "batches/GrDrawBatch.h" @@ -107,13 +106,12 @@ protected: GrColor color = kColors[procColor]; sk_sp<GrFragmentProcessor> fp(GrConstColorProcessor::Make(color, mode)); - GrPipelineBuilder pipelineBuilder(grPaint, drawContext->mustUseHWAA(grPaint)); - pipelineBuilder.addColorFragmentProcessor(std::move(fp)); + grPaint.addColorFragmentProcessor(std::move(fp)); SkAutoTUnref<GrDrawBatch> batch( GrRectBatchFactory::CreateNonAAFill(grPaint.getColor(), viewMatrix, renderRect, nullptr, nullptr)); - drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBuilder, batch); + drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, 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/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index 3f8ae09a1a..a5c2904566 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -178,13 +178,13 @@ protected: continue; } - GrPipelineBuilder pipelineBuilder; - pipelineBuilder.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); - pipelineBuilder.addCoverageFragmentProcessor(std::move(fp)); + GrPaint grPaint; + grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); + grPaint.addCoverageFragmentProcessor(std::move(fp)); SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(p.getBounds(), 0xff000000)); - drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBuilder, batch); + drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch); x += SkScalarCeilToScalar(path->getBounds().width() + kDX); } @@ -217,13 +217,13 @@ protected: continue; } - GrPipelineBuilder pipelineBuilder; - pipelineBuilder.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); - pipelineBuilder.addCoverageFragmentProcessor(std::move(fp)); + GrPaint grPaint; + grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); + grPaint.addCoverageFragmentProcessor(std::move(fp)); SkAutoTUnref<GrDrawBatch> batch(new PolyBoundsBatch(rect, 0xff000000)); - drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBuilder, batch); + drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch); x += SkScalarCeilToScalar(rect.width() + kDX); } diff --git a/gm/dcshader.cpp b/gm/dcshader.cpp index 2b179a0a1f..3ed6dc1296 100644 --- a/gm/dcshader.cpp +++ b/gm/dcshader.cpp @@ -9,6 +9,7 @@ #if SK_SUPPORT_GPU #include "GrFragmentProcessor.h" #include "GrCoordTransform.h" +#include "GrInvariantOutput.h" #include "effects/GrXfermodeFragmentProcessor.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" diff --git a/gm/rrects.cpp b/gm/rrects.cpp index e104aea433..0f3ac56fec 100644 --- a/gm/rrects.cpp +++ b/gm/rrects.cpp @@ -101,16 +101,15 @@ protected: canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); if (kEffect_Type == fType) { #if SK_SUPPORT_GPU - GrPipelineBuilder pipelineBuilder; - pipelineBuilder.setXPFactory( - GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); + GrPaint grPaint; + grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); SkRRect rrect = fRRects[curRRect]; rrect.offset(SkIntToScalar(x), SkIntToScalar(y)); GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; sk_sp<GrFragmentProcessor> fp(GrRRectEffect::Make(edgeType, rrect)); if (fp) { - pipelineBuilder.addCoverageFragmentProcessor(std::move(fp)); + grPaint.addCoverageFragmentProcessor(std::move(fp)); SkRect bounds = rrect.getBounds(); bounds.outset(2.f, 2.f); @@ -118,8 +117,7 @@ protected: SkAutoTUnref<GrDrawBatch> batch( GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMatrix::I(), bounds, nullptr, nullptr)); - drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBuilder, - batch); + drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch); } else { drew = false; } diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp index cac2b9c8d5..3680006cc5 100644 --- a/gm/texturedomaineffect.cpp +++ b/gm/texturedomaineffect.cpp @@ -112,9 +112,8 @@ protected: SkScalar x = kDrawPad + kTestPad; for (int m = 0; m < GrTextureDomain::kModeCount; ++m) { GrTextureDomain::Mode mode = (GrTextureDomain::Mode) m; - GrPipelineBuilder pipelineBuilder; - pipelineBuilder.setXPFactory( - GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); + GrPaint grPaint; + grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); sk_sp<GrFragmentProcessor> fp( GrTextureDomainEffect::Make(texture, textureMatrices[tm], GrTextureDomain::MakeTexelDomain(texture, @@ -125,12 +124,12 @@ protected: continue; } const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y); - pipelineBuilder.addColorFragmentProcessor(std::move(fp)); + grPaint.addColorFragmentProcessor(std::move(fp)); SkAutoTUnref<GrDrawBatch> batch( GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr)); - drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBuilder, batch); + drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch); x += renderRect.width() + kTestPad; } y += renderRect.height() + kTestPad; diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp index a153c991fc..0be30088c8 100644 --- a/gm/yuvtorgbeffect.cpp +++ b/gm/yuvtorgbeffect.cpp @@ -13,7 +13,6 @@ #include "GrContext.h" #include "GrDrawContextPriv.h" -#include "GrPipelineBuilder.h" #include "SkBitmap.h" #include "SkGr.h" #include "SkGradientShader.h" @@ -113,19 +112,19 @@ protected: {1, 2, 0}, {2, 0, 1}, {2, 1, 0}}; for (int i = 0; i < 6; ++i) { - GrPipelineBuilder pipelineBuilder; - pipelineBuilder.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); + GrPaint grPaint; + grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); sk_sp<GrFragmentProcessor> fp(GrYUVEffect::MakeYUVToRGB( texture[indices[i][0]], texture[indices[i][1]], texture[indices[i][2]], sizes, static_cast<SkYUVColorSpace>(space), false)); if (fp) { SkMatrix viewMatrix; viewMatrix.setTranslate(x, y); - pipelineBuilder.addColorFragmentProcessor(std::move(fp)); + grPaint.addColorFragmentProcessor(std::move(fp)); SkAutoTUnref<GrDrawBatch> batch( GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr)); - drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBuilder, batch); + drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch); } x += renderRect.width() + kTestPad; } @@ -225,18 +224,18 @@ protected: SkScalar y = kDrawPad + kTestPad + space * kColorSpaceOffset; SkScalar x = kDrawPad + kTestPad; - GrPipelineBuilder pipelineBuilder; - pipelineBuilder.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); + GrPaint grPaint; + grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode)); sk_sp<GrFragmentProcessor> fp( GrYUVEffect::MakeYUVToRGB(texture[0], texture[1], texture[2], sizes, static_cast<SkYUVColorSpace>(space), true)); if (fp) { SkMatrix viewMatrix; viewMatrix.setTranslate(x, y); - pipelineBuilder.addColorFragmentProcessor(fp); + grPaint.addColorFragmentProcessor(fp); SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill( GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr)); - drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBuilder, batch); + drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch); } } } |