Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1005)

Unified Diff: gm/convexpolyeffect.cpp

Issue 732693002: Drawstate on stack (Closed) Base URL: https://skia.googlesource.com/skia.git@real_def_gp
Patch Set: tiny fix Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/beziereffects.cpp ('k') | gm/rrects.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/convexpolyeffect.cpp
diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp
index 9f4c48b4eb741452a583bda24efd17d2fbd6f310..8ee4a5db6f1312e04fa310d9d2333e492a9977cd 100644
--- a/gm/convexpolyeffect.cpp
+++ b/gm/convexpolyeffect.cpp
@@ -121,8 +121,6 @@ protected:
SkDEBUGFAIL("Couldn't get Gr test target.");
return;
}
- GrDrawState* drawState = tt.target()->drawState();
-
SkMatrix m;
SkPath p;
m.setTranslate(x, y);
@@ -133,13 +131,15 @@ protected:
if (!fp) {
continue;
}
- drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(false))->unref();
- drawState->addCoverageProcessor(fp);
- drawState->setIdentityViewMatrix();
- drawState->setRenderTarget(rt);
- drawState->setColor(0xff000000);
- GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, 0);
+ GrDrawState ds;
+ ds.setGeometryProcessor(GrDefaultGeoProcFactory::Create(false))->unref();
+ ds.addCoverageProcessor(fp);
+ ds.setIdentityViewMatrix();
+ ds.setRenderTarget(rt);
+ ds.setColor(0xff000000);
+
+ GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, ds.getVertexStride(), 0);
SkPoint* verts = reinterpret_cast<SkPoint*>(geo.vertices());
SkRect bounds = p.getBounds();
@@ -149,7 +149,7 @@ protected:
bounds.toQuad(verts);
tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
- tt.target()->drawIndexed(kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
+ tt.target()->drawIndexed(&ds, kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
x += SkScalarCeilToScalar(path->getBounds().width() + 10.f);
}
@@ -188,14 +188,14 @@ protected:
continue;
}
- GrDrawState* drawState = tt.target()->drawState();
- drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(false))->unref();
- drawState->addCoverageProcessor(fp);
- drawState->setIdentityViewMatrix();
- drawState->setRenderTarget(rt);
- drawState->setColor(0xff000000);
+ GrDrawState ds;
+ ds.setGeometryProcessor(GrDefaultGeoProcFactory::Create(false))->unref();
+ ds.addCoverageProcessor(fp);
+ ds.setIdentityViewMatrix();
+ ds.setRenderTarget(rt);
+ ds.setColor(0xff000000);
- GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, 0);
+ GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, ds.getVertexStride(), 0);
SkPoint* verts = reinterpret_cast<SkPoint*>(geo.vertices());
SkRect bounds = rect;
@@ -203,7 +203,7 @@ protected:
bounds.toQuad(verts);
tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
- tt.target()->drawIndexed(kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
+ tt.target()->drawIndexed(&ds, kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
x += SkScalarCeilToScalar(rect.width() + 10.f);
}
« no previous file with comments | « gm/beziereffects.cpp ('k') | gm/rrects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698