diff options
author | Brian Salomon <bsalomon@google.com> | 2017-04-03 10:38:00 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-03 15:13:48 +0000 |
commit | d3ccb0a37f0e62c84fdcd6a77b7b15476b04db7a (patch) | |
tree | a050c5624e60eee8193f4aa015269ad3bf14e329 /gm | |
parent | dffe9827b18444d1426859d9035f9f0087201f44 (diff) |
Move pipeline handling out of GrMeshDrawOp.
The monolithic GrPipeline is moved to a subclass GrLegacyDrawMeshOp.
The pipeline used to record a GrMesh draw in a GrMeshDrawOp must now be passed rather than implicitly using the op's pipeline.
Change-Id: I50d77e4dcc8d91a523fa7566ce43a9a291174706
Reviewed-on: https://skia-review.googlesource.com/11002
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'gm')
-rw-r--r-- | gm/beziereffects.cpp | 31 | ||||
-rw-r--r-- | gm/bigrrectaaeffect.cpp | 4 | ||||
-rw-r--r-- | gm/constcolorprocessor.cpp | 4 | ||||
-rw-r--r-- | gm/convexpolyeffect.cpp | 15 | ||||
-rw-r--r-- | gm/etc1.cpp | 6 | ||||
-rw-r--r-- | gm/rrects.cpp | 4 | ||||
-rw-r--r-- | gm/texturedomaineffect.cpp | 4 | ||||
-rw-r--r-- | gm/yuvtorgbeffect.cpp | 8 |
8 files changed, 39 insertions, 37 deletions
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp index 523ccd31f8..c67018d2af 100644 --- a/gm/beziereffects.cpp +++ b/gm/beziereffects.cpp @@ -30,9 +30,10 @@ public: const char* name() const override { return "BezierCubicOrConicTestOp"; } - static std::unique_ptr<GrMeshDrawOp> Make(sk_sp<GrGeometryProcessor> gp, const SkRect& rect, - GrColor color, const SkMatrix& klm, SkScalar sign) { - return std::unique_ptr<GrMeshDrawOp>( + static std::unique_ptr<GrLegacyMeshDrawOp> Make(sk_sp<GrGeometryProcessor> gp, + const SkRect& rect, GrColor color, + const SkMatrix& klm, SkScalar sign) { + return std::unique_ptr<GrLegacyMeshDrawOp>( new BezierCubicOrConicTestOp(gp, rect, color, klm, sign)); } @@ -66,7 +67,7 @@ private: SkScalar pt3[3] = {verts[v].fPosition.x(), verts[v].fPosition.y(), 1.f}; fKLM.mapHomogeneousPoints(verts[v].fKLM, pt3, 1); } - helper.recordDraw(target, fGeometryProcessor.get()); + helper.recordDraw(target, fGeometryProcessor.get(), this->pipeline()); } SkMatrix fKLM; @@ -197,10 +198,10 @@ protected: sign = -1.0f; } - std::unique_ptr<GrMeshDrawOp> op = + std::unique_ptr<GrLegacyMeshDrawOp> op = BezierCubicOrConicTestOp::Make(gp, bounds, color, klm, sign); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(grPaint), GrAAType::kNone, std::move(op)); } ++col; @@ -330,10 +331,10 @@ protected: GrPaint grPaint; grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); - std::unique_ptr<GrMeshDrawOp> op = + std::unique_ptr<GrLegacyMeshDrawOp> op = BezierCubicOrConicTestOp::Make(gp, bounds, color, klm, 1.f); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(grPaint), GrAAType::kNone, std::move(op)); } ++col; @@ -396,10 +397,10 @@ public: DEFINE_OP_CLASS_ID const char* name() const override { return "BezierQuadTestOp"; } - static std::unique_ptr<GrMeshDrawOp> Make(sk_sp<GrGeometryProcessor> gp, const SkRect& rect, - GrColor color, - const GrPathUtils::QuadUVMatrix& devToUV) { - return std::unique_ptr<GrMeshDrawOp>(new BezierQuadTestOp(gp, rect, color, devToUV)); + static std::unique_ptr<GrLegacyMeshDrawOp> Make(sk_sp<GrGeometryProcessor> gp, + const SkRect& rect, GrColor color, + const GrPathUtils::QuadUVMatrix& devToUV) { + return std::unique_ptr<GrLegacyMeshDrawOp>(new BezierQuadTestOp(gp, rect, color, devToUV)); } private: @@ -426,7 +427,7 @@ private: verts[0].fPosition.setRectFan(fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom, sizeof(Vertex)); fDevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); - helper.recordDraw(target, fGeometryProcessor.get()); + helper.recordDraw(target, fGeometryProcessor.get(), this->pipeline()); } GrPathUtils::QuadUVMatrix fDevToUV; @@ -548,10 +549,10 @@ protected: GrPathUtils::QuadUVMatrix DevToUV(pts); - std::unique_ptr<GrMeshDrawOp> op = + std::unique_ptr<GrLegacyMeshDrawOp> op = BezierQuadTestOp::Make(gp, bounds, color, DevToUV); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(grPaint), GrAAType::kNone, std::move(op)); } ++col; diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp index 0520776474..786e1775c1 100644 --- a/gm/bigrrectaaeffect.cpp +++ b/gm/bigrrectaaeffect.cpp @@ -87,9 +87,9 @@ protected: SkRect bounds = testBounds; bounds.offset(SkIntToScalar(x), SkIntToScalar(y)); - std::unique_ptr<GrMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( + std::unique_ptr<GrLegacyMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( 0xff000000, SkMatrix::I(), bounds, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(grPaint), GrAAType::kNone, std::move(op)); } canvas->restore(); diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp index 9f30bed4eb..a595a07d38 100644 --- a/gm/constcolorprocessor.cpp +++ b/gm/constcolorprocessor.cpp @@ -110,9 +110,9 @@ protected: grPaint.addColorFragmentProcessor(std::move(fp)); - std::unique_ptr<GrMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( + std::unique_ptr<GrLegacyMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( grPaint.getColor(), viewMatrix, renderRect, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(grPaint), GrAAType::kNone, std::move(op)); // Draw labels for the input to the processor and the processor to the right of diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index 0ce7ba71ab..8ace4d0b3d 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -46,8 +46,8 @@ public: const char* name() const override { return "PolyBoundsOp"; } - static std::unique_ptr<GrMeshDrawOp> Make(const SkRect& rect, GrColor color) { - return std::unique_ptr<GrMeshDrawOp>(new PolyBoundsOp(rect, color)); + static std::unique_ptr<GrLegacyMeshDrawOp> Make(const SkRect& rect, GrColor color) { + return std::unique_ptr<GrLegacyMeshDrawOp>(new PolyBoundsOp(rect, color)); } private: @@ -71,7 +71,7 @@ private: fRect.toQuad(verts); - helper.recordDraw(target, gp.get()); + helper.recordDraw(target, gp.get(), this->pipeline()); } SkRect fRect; @@ -183,9 +183,10 @@ protected: grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); grPaint.addCoverageFragmentProcessor(std::move(fp)); - std::unique_ptr<GrMeshDrawOp> op = PolyBoundsOp::Make(p.getBounds(), 0xff000000); + std::unique_ptr<GrLegacyMeshDrawOp> op = + PolyBoundsOp::Make(p.getBounds(), 0xff000000); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(grPaint), GrAAType::kNone, std::move(op)); x += SkScalarCeilToScalar(path->getBounds().width() + kDX); @@ -223,9 +224,9 @@ protected: grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); grPaint.addCoverageFragmentProcessor(std::move(fp)); - std::unique_ptr<GrMeshDrawOp> op = PolyBoundsOp::Make(rect, 0xff000000); + std::unique_ptr<GrLegacyMeshDrawOp> op = PolyBoundsOp::Make(rect, 0xff000000); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(grPaint), GrAAType::kNone, std::move(op)); x += SkScalarCeilToScalar(rect.width() + kDX); diff --git a/gm/etc1.cpp b/gm/etc1.cpp index 26e6051852..369a62c330 100644 --- a/gm/etc1.cpp +++ b/gm/etc1.cpp @@ -99,10 +99,10 @@ protected: SkRect rect = SkRect::MakeXYWH(kPad, kPad, kTexWidth, kTexHeight); - std::unique_ptr<GrMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( + std::unique_ptr<GrLegacyMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( GrColor_WHITE, SkMatrix::I(), rect, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_addMeshDrawOp(std::move(grPaint), GrAAType::kNone, - std::move(op)); + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( + std::move(grPaint), GrAAType::kNone, std::move(op)); } private: diff --git a/gm/rrects.cpp b/gm/rrects.cpp index ac66d521cb..8219681b14 100644 --- a/gm/rrects.cpp +++ b/gm/rrects.cpp @@ -115,9 +115,9 @@ protected: SkRect bounds = rrect.getBounds(); bounds.outset(2.f, 2.f); - std::unique_ptr<GrMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( + std::unique_ptr<GrLegacyMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( 0xff000000, SkMatrix::I(), bounds, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(grPaint), GrAAType::kNone, std::move(op)); } else { drew = false; diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp index 88bcc57c9a..6a296f4d1f 100644 --- a/gm/texturedomaineffect.cpp +++ b/gm/texturedomaineffect.cpp @@ -134,9 +134,9 @@ protected: const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y); grPaint.addColorFragmentProcessor(std::move(fp)); - std::unique_ptr<GrMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( + std::unique_ptr<GrLegacyMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(grPaint), GrAAType::kNone, std::move(op)); x += renderRect.width() + kTestPad; } diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp index fda0565559..87d76cb2ac 100644 --- a/gm/yuvtorgbeffect.cpp +++ b/gm/yuvtorgbeffect.cpp @@ -132,9 +132,9 @@ protected: grPaint.addColorFragmentProcessor(std::move(fp)); SkMatrix viewMatrix; viewMatrix.setTranslate(x, y); - std::unique_ptr<GrMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( + std::unique_ptr<GrLegacyMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(grPaint), GrAAType::kNone, std::move(op)); } x += renderRect.width() + kTestPad; @@ -257,9 +257,9 @@ protected: SkMatrix viewMatrix; viewMatrix.setTranslate(x, y); grPaint.addColorFragmentProcessor(fp); - std::unique_ptr<GrMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( + std::unique_ptr<GrLegacyMeshDrawOp> op(GrRectOpFactory::MakeNonAAFill( GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(grPaint), GrAAType::kNone, std::move(op)); } } |