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

Unified Diff: gm/beziereffects.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 | « expectations/gm/ignored-tests.txt ('k') | gm/convexpolyeffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/beziereffects.cpp
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index 0e811d9c0501f0b4ba3b3fe15248d4f7cd19ae6a..3de47d3be23f8e2a999f73d28737097c083edf0b 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -158,10 +158,10 @@ protected:
context->getTestTarget(&tt);
SkASSERT(tt.target());
- GrDrawState* drawState = tt.target()->drawState();
- drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
+ GrDrawState ds;
+ ds.setVertexAttribs<kAttribs>(2, sizeof(Vertex));
- GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, 0);
+ GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, ds.getVertexStride(), 0);
Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices());
verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop,
@@ -173,12 +173,12 @@ protected:
verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f);
}
- drawState->setGeometryProcessor(gp);
- drawState->setRenderTarget(rt);
- drawState->setColor(0xff000000);
+ ds.setGeometryProcessor(gp);
+ ds.setRenderTarget(rt);
+ ds.setColor(0xff000000);
tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
- tt.target()->drawIndexed(kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
+ tt.target()->drawIndexed(&ds, kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
}
++col;
if (numCols == col) {
@@ -315,10 +315,10 @@ protected:
context->getTestTarget(&tt);
SkASSERT(tt.target());
- GrDrawState* drawState = tt.target()->drawState();
- drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
+ GrDrawState ds;
+ ds.setVertexAttribs<kAttribs>(2, sizeof(Vertex));
- GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, 0);
+ GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, ds.getVertexStride(), 0);
Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices());
verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop,
@@ -330,12 +330,12 @@ protected:
verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f);
}
- drawState->setGeometryProcessor(gp);
- drawState->setRenderTarget(rt);
- drawState->setColor(0xff000000);
+ ds.setGeometryProcessor(gp);
+ ds.setRenderTarget(rt);
+ ds.setColor(0xff000000);
tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
- tt.target()->drawIndexed(kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
+ tt.target()->drawIndexed(&ds, kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
}
++col;
if (numCols == col) {
@@ -503,10 +503,10 @@ protected:
context->getTestTarget(&tt);
SkASSERT(tt.target());
- GrDrawState* drawState = tt.target()->drawState();
- drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
+ GrDrawState ds;
+ ds.setVertexAttribs<kAttribs>(2, sizeof(Vertex));
- GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, 0);
+ GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, ds.getVertexStride(), 0);
Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices());
verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop,
@@ -516,12 +516,12 @@ protected:
GrPathUtils::QuadUVMatrix DevToUV(pts);
DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts);
- drawState->setGeometryProcessor(gp);
- drawState->setRenderTarget(rt);
- drawState->setColor(0xff000000);
+ ds.setGeometryProcessor(gp);
+ ds.setRenderTarget(rt);
+ ds.setColor(0xff000000);
tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
- tt.target()->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 4, 6);
+ tt.target()->drawIndexed(&ds, kTriangles_GrPrimitiveType, 0, 0, 4, 6);
}
++col;
if (numCols == col) {
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | gm/convexpolyeffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698