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

Unified Diff: gm/beziereffects.cpp

Issue 696353002: Test factory uses the inorder draw buffer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 ec7e83e763bd0d4cda3ad6b781e7fc880ba62500..0e811d9c0501f0b4ba3b3fe15248d4f7cd19ae6a 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -154,7 +154,16 @@ protected:
boundsPaint.setStyle(SkPaint::kStroke_Style);
canvas->drawRect(bounds, boundsPaint);
- Vertex verts[4];
+ GrTestTarget tt;
+ context->getTestTarget(&tt);
+ SkASSERT(tt.target());
+
+ GrDrawState* drawState = tt.target()->drawState();
+ drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
+
+ GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, 0);
+ Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices());
+
verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop,
bounds.fRight, bounds.fBottom,
sizeof(Vertex));
@@ -164,17 +173,10 @@ protected:
verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f);
}
- GrTestTarget tt;
- context->getTestTarget(&tt);
- SkASSERT(tt.target());
- GrDrawState* drawState = tt.target()->drawState();
- drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
-
drawState->setGeometryProcessor(gp);
drawState->setRenderTarget(rt);
drawState->setColor(0xff000000);
- tt.target()->setVertexSourceToArray(verts, 4);
tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
tt.target()->drawIndexed(kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
}
@@ -309,7 +311,16 @@ protected:
boundsPaint.setStyle(SkPaint::kStroke_Style);
canvas->drawRect(bounds, boundsPaint);
- Vertex verts[4];
+ GrTestTarget tt;
+ context->getTestTarget(&tt);
+ SkASSERT(tt.target());
+
+ GrDrawState* drawState = tt.target()->drawState();
+ drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
+
+ GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, 0);
+ Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices());
+
verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop,
bounds.fRight, bounds.fBottom,
sizeof(Vertex));
@@ -319,17 +330,10 @@ protected:
verts[v].fKLM[2] = eval_line(verts[v].fPosition, klmEqs + 6, 1.f);
}
- GrTestTarget tt;
- context->getTestTarget(&tt);
- SkASSERT(tt.target());
- GrDrawState* drawState = tt.target()->drawState();
- drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
-
drawState->setGeometryProcessor(gp);
drawState->setRenderTarget(rt);
drawState->setColor(0xff000000);
- tt.target()->setVertexSourceToArray(verts, 4);
tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
tt.target()->drawIndexed(kTriangleFan_GrPrimitiveType, 0, 0, 4, 6);
}
@@ -495,7 +499,16 @@ protected:
boundsPaint.setStyle(SkPaint::kStroke_Style);
canvas->drawRect(bounds, boundsPaint);
- Vertex verts[4];
+ GrTestTarget tt;
+ context->getTestTarget(&tt);
+ SkASSERT(tt.target());
+
+ GrDrawState* drawState = tt.target()->drawState();
+ drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
+
+ GrDrawTarget::AutoReleaseGeometry geo(tt.target(), 4, 0);
+ Vertex* verts = reinterpret_cast<Vertex*>(geo.vertices());
+
verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop,
bounds.fRight, bounds.fBottom,
sizeof(Vertex));
@@ -503,17 +516,10 @@ protected:
GrPathUtils::QuadUVMatrix DevToUV(pts);
DevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts);
- GrTestTarget tt;
- context->getTestTarget(&tt);
- SkASSERT(tt.target());
- GrDrawState* drawState = tt.target()->drawState();
- drawState->setVertexAttribs<kAttribs>(2, sizeof(Vertex));
-
drawState->setGeometryProcessor(gp);
drawState->setRenderTarget(rt);
drawState->setColor(0xff000000);
- tt.target()->setVertexSourceToArray(verts, 4);
tt.target()->setIndexSourceToBuffer(context->getQuadIndexBuffer());
tt.target()->drawIndexed(kTriangles_GrPrimitiveType, 0, 0, 4, 6);
}
« 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