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

Unified Diff: src/gpu/GrAAConvexPathRenderer.cpp

Issue 732693002: Drawstate on stack (Closed) Base URL: https://skia.googlesource.com/skia.git@real_def_gp
Patch Set: ready 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
Index: src/gpu/GrAAConvexPathRenderer.cpp
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 3325b1cf68b184414a1e94b22260b0c9f26da787..03d8377d554435c24d42fd53ed37d0370642370e 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -609,9 +609,10 @@ GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random,
///////////////////////////////////////////////////////////////////////////////
-bool GrAAConvexPathRenderer::canDrawPath(const SkPath& path,
+bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target,
+ const GrDrawState*,
+ const SkPath& path,
const SkStrokeRec& stroke,
- const GrDrawTarget* target,
bool antiAlias) const {
return (target->caps()->shaderDerivativeSupport() && antiAlias &&
stroke.isFillStyle() && !path.isInverseFillType() && path.isConvex());
@@ -627,9 +628,10 @@ extern const GrVertexAttrib gPathAttribs[] = {
};
-bool GrAAConvexPathRenderer::onDrawPath(const SkPath& origPath,
+bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target,
+ GrDrawState* drawState,
+ const SkPath& origPath,
const SkStrokeRec&,
- GrDrawTarget* target,
bool antiAlias) {
const SkPath* path = &origPath;
@@ -637,12 +639,10 @@ bool GrAAConvexPathRenderer::onDrawPath(const SkPath& origPath,
return true;
}
- SkMatrix viewMatrix = target->getDrawState().getViewMatrix();
- GrDrawTarget::AutoStateRestore asr;
- if (!asr.setIdentity(target, GrDrawTarget::kPreserve_ASRInit)) {
+ SkMatrix viewMatrix = drawState->getViewMatrix();
+ if (!drawState->setIdentityViewMatrix()) {
return false;
}
- GrDrawState* drawState = target->drawState();
// We use the fact that SkPath::transform path does subdivision based on
// perspective. Otherwise, we apply the view matrix when copying to the
@@ -681,7 +681,7 @@ bool GrAAConvexPathRenderer::onDrawPath(const SkPath& origPath,
GrGeometryProcessor* quadProcessor = QuadEdgeEffect::Create();
drawState->setGeometryProcessor(quadProcessor)->unref();
- GrDrawTarget::AutoReleaseGeometry arg(target, vCount, iCount);
+ GrDrawTarget::AutoReleaseGeometry arg(target, vCount, drawState->getVertexStride(), iCount);
if (!arg.succeeded()) {
return false;
}
@@ -706,7 +706,8 @@ bool GrAAConvexPathRenderer::onDrawPath(const SkPath& origPath,
int vOffset = 0;
for (int i = 0; i < draws.count(); ++i) {
const Draw& draw = draws[i];
- target->drawIndexed(kTriangles_GrPrimitiveType,
+ target->drawIndexed(drawState,
+ kTriangles_GrPrimitiveType,
vOffset, // start vertex
0, // start index
draw.fVertexCnt,

Powered by Google App Engine
This is Rietveld 408576698