Reland path bounds change with correct bounds for convex and hairline path renderers.
R=robertphillips@google.com
Review URL: https://codereview.chromium.org/15465005
git-svn-id: http://skia.googlecode.com/svn/trunk@9194 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index fc6cae6..e76f0c8 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -660,6 +660,24 @@
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 @@
vOffset, // start vertex
0, // start index
draw.fVertexCnt,
- draw.fIndexCnt);
+ draw.fIndexCnt,
+ &devBounds);
vOffset += draw.fVertexCnt;
}