diff options
author | joshualitt <joshualitt@chromium.org> | 2016-01-13 07:47:38 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-13 07:47:38 -0800 |
commit | f5883a6d75a18c581507214d3057b5c721ed1ffc (patch) | |
tree | f9921193781c157919a5defe0de531ddb36b3c2e /gm/convexpolyeffect.cpp | |
parent | bc90735170b5d85a19b24df0baa865f7cf87d348 (diff) |
Hide drawBatch on GrDrawTarget from test Methods
TBR=bsalomon@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1574383002
Review URL: https://codereview.chromium.org/1574383002
Diffstat (limited to 'gm/convexpolyeffect.cpp')
-rw-r--r-- | gm/convexpolyeffect.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index fb767ddc89..4071159d48 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -14,6 +14,7 @@ #include "GrContext.h" #include "GrDefaultGeoProcFactory.h" +#include "GrDrawContext.h" #include "GrPathUtils.h" #include "GrTest.h" #include "SkColorPriv.h" @@ -32,7 +33,9 @@ class ConvexPolyTestBatch : public GrTestBatch { public: DEFINE_BATCH_CLASS_ID struct Geometry : public GrTestBatch::Geometry { - SkRect fBounds; + SkRect fRect; + SkRect fBounds; // This will be == fRect, except fBounds must be sorted, whereas fRect can + // be inverted }; const char* name() const override { return "ConvexPolyTestBatch"; } @@ -48,6 +51,7 @@ private: // Make sure any artifacts around the exterior of path are visible by using overly // conservative bounding geometry. fGeometry.fBounds.outset(5.f, 5.f); + fGeometry.fRect.outset(5.f, 5.f); } Geometry* geoData(int index) override { @@ -69,7 +73,7 @@ private: return; } - fGeometry.fBounds.toQuad(verts); + fGeometry.fRect.toQuad(verts); helper.recordDraw(target); } @@ -159,6 +163,11 @@ protected: return; } + SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt)); + if (!drawContext) { + return; + } + Color color(0xff000000); Coverage coverage(Coverage::kSolid_Type); LocalCoords localCoords(LocalCoords::kUnused_Type); @@ -173,12 +182,6 @@ protected: SkScalar x = 0; for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) { - GrTestTarget tt; - context->getTestTarget(&tt, rt); - if (nullptr == tt.target()) { - SkDEBUGFAIL("Couldn't get Gr test target."); - return; - } const SkMatrix m = SkMatrix::MakeTrans(x, y); SkPath p; path->transform(m, &p); @@ -197,11 +200,12 @@ protected: ConvexPolyTestBatch::Geometry geometry; geometry.fColor = color.fColor; + geometry.fRect = p.getBounds(); geometry.fBounds = p.getBounds(); SkAutoTUnref<GrDrawBatch> batch(ConvexPolyTestBatch::Create(gp, geometry)); - tt.target()->drawBatch(pipelineBuilder, batch); + drawContext->internal_drawBatch(pipelineBuilder, batch); x += SkScalarCeilToScalar(path->getBounds().width() + 10.f); } @@ -226,12 +230,6 @@ protected: SkScalar x = 0; for (int et = 0; et < kGrProcessorEdgeTypeCnt; ++et) { - GrTestTarget tt; - context->getTestTarget(&tt, rt); - if (nullptr == tt.target()) { - SkDEBUGFAIL("Couldn't get Gr test target."); - return; - } SkRect rect = *iter.get(); rect.offset(x, y); GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; @@ -248,11 +246,13 @@ protected: ConvexPolyTestBatch::Geometry geometry; geometry.fColor = color.fColor; + geometry.fRect = rect; geometry.fBounds = rect; + geometry.fBounds.sort(); SkAutoTUnref<GrDrawBatch> batch(ConvexPolyTestBatch::Create(gp, geometry)); - tt.target()->drawBatch(pipelineBuilder, batch); + drawContext->internal_drawBatch(pipelineBuilder, batch); x += SkScalarCeilToScalar(rect.width() + 10.f); } |