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

Unified Diff: src/gpu/GrAAConvexPathRenderer.cpp

Issue 15465005: Reland path bounds change with correct bounds for convex and hairline path renderers. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: tighter tolerances Created 7 years, 7 months 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 | « no previous file | src/gpu/GrAAHairLinePathRenderer.h » ('j') | src/gpu/GrAAHairLinePathRenderer.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAAConvexPathRenderer.cpp
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index fc6cae68c62298fc26430154ae6c9090f47f2bf7..e76f0c805a07c07c682be9fbe00dfdf701faba15 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -660,6 +660,24 @@ bool GrAAConvexPathRenderer::onDrawPath(const SkPath& origPath,
SkSTArray<kPreallocDrawCnt, Draw, true> draws;
create_vertices(segments, fanPt, &draws, verts, idxs);
+ // This is valid because all the computed verts are within 1 pixel of the path control points.
+ SkRect devBounds;
+ devBounds = origPath.getBounds();
+ adcd.getOriginalMatrix().mapRect(&devBounds);
+ devBounds.outset(SK_Scalar1, SK_Scalar1);
+
+ // Check devBounds
+#if GR_DEBUG
+ SkRect tolDevBounds = devBounds;
+ tolDevBounds.outset(SK_Scalar1 / 10000, SK_Scalar1 / 10000);
+ SkRect actualBounds;
+ actualBounds.set(verts[0].fPos, verts[1].fPos);
+ for (int i = 2; i < vCount; ++i) {
+ actualBounds.growToInclude(verts[i].fPos.fX, verts[i].fPos.fY);
+ }
+ GrAssert(tolDevBounds.contains(actualBounds));
+#endif
+
int vOffset = 0;
for (int i = 0; i < draws.count(); ++i) {
const Draw& draw = draws[i];
@@ -667,7 +685,8 @@ bool GrAAConvexPathRenderer::onDrawPath(const SkPath& origPath,
vOffset, // start vertex
0, // start index
draw.fVertexCnt,
- draw.fIndexCnt);
+ draw.fIndexCnt,
+ &devBounds);
vOffset += draw.fVertexCnt;
}
« no previous file with comments | « no previous file | src/gpu/GrAAHairLinePathRenderer.h » ('j') | src/gpu/GrAAHairLinePathRenderer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698