diff options
Diffstat (limited to 'gm/convexpolyeffect.cpp')
-rw-r--r-- | gm/convexpolyeffect.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index f438a08b9..e9892fef0 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -51,19 +51,19 @@ protected: // This is a GPU-specific GM. return kGPUOnly_Flag; } - + virtual void onOnceBeforeDraw() SK_OVERRIDE { SkPath tri; tri.moveTo(5.f, 5.f); tri.lineTo(100.f, 20.f); tri.lineTo(15.f, 100.f); - + fPaths.addToTail(tri); fPaths.addToTail(SkPath())->reverseAddPath(tri); - + tri.close(); fPaths.addToTail(tri); - + SkPath ngon; static const SkScalar kRadius = 50.f; const SkPoint center = { kRadius, kRadius }; @@ -79,7 +79,7 @@ protected: ngon.lineTo(point); } } - + fPaths.addToTail(ngon); SkMatrix scaleM; scaleM.setScale(1.1f, 0.4f); @@ -114,12 +114,12 @@ protected: } GrDrawState* drawState = tt.target()->drawState(); drawState->setVertexAttribs<kAttribs>(SK_ARRAY_COUNT(kAttribs)); - + SkMatrix m; SkPath p; m.setTranslate(x, y); path->transform(m, &p); - + GrConvexPolyEffect::EdgeType edgeType = (GrConvexPolyEffect::EdgeType) et; SkAutoTUnref<GrEffectRef> effect(GrConvexPolyEffect::Create(edgeType, p)); if (!effect) { @@ -130,7 +130,7 @@ protected: drawState->setIdentityViewMatrix(); drawState->setRenderTarget(rt); drawState->setColor(0xff000000); - + SkPoint verts[4]; SkRect bounds = p.getBounds(); // Make sure any artifacts around the exterior of path are visible by using overly @@ -141,10 +141,10 @@ protected: tt.target()->setVertexSourceToArray(verts, 4); tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer()); tt.target()->drawIndexed(kTriangleFan_GrPrimitiveType, 0, 0, 4, 6); - + x += path->getBounds().width() + 10.f; } - + // Draw AA and non AA paths using normal API for reference. canvas->save(); canvas->translate(x, y); @@ -154,7 +154,7 @@ protected: paint.setAntiAlias(true); canvas->drawPath(*path, paint); canvas->restore(); - + y += path->getBounds().height() + 20.f; } } |