Fix missing tolerance in GrPathUtils::worstCasePointCount
authorRobert Phillips <robertphillips@google.com>
Tue, 18 Apr 2017 20:56:06 +0000 (16:56 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Tue, 18 Apr 2017 21:38:30 +0000 (21:38 +0000)
https://skia-review.googlesource.com/c/10752/ (Use correct tolerance for
conic chopping in MSAA and default path renderers) changed the tolerance
used in createGeom but didn't change the setting in worstCasePointCount.

Bug: 711936, 712749
Change-Id: I540d8bc8cfdebc3eae5204e1acfeba3cefc2b12e
Reviewed-on: https://skia-review.googlesource.com/13768
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>

src/gpu/GrPathUtils.cpp

index 57bb86f..8e0a9fc 100644 (file)
@@ -36,8 +36,7 @@ SkScalar GrPathUtils::scaleToleranceToSrc(SkScalar devTol,
 static const int MAX_POINTS_PER_CURVE = 1 << 10;
 static const SkScalar gMinCurveTol = 0.0001f;
 
-uint32_t GrPathUtils::quadraticPointCount(const SkPoint points[],
-                                          SkScalar tol) {
+uint32_t GrPathUtils::quadraticPointCount(const SkPoint points[], SkScalar tol) {
     if (tol < gMinCurveTol) {
         tol = gMinCurveTol;
     }
@@ -158,8 +157,7 @@ uint32_t GrPathUtils::generateCubicPoints(const SkPoint& p0,
     return a + b;
 }
 
-int GrPathUtils::worstCasePointCount(const SkPath& path, int* subpaths,
-                                     SkScalar tol) {
+int GrPathUtils::worstCasePointCount(const SkPath& path, int* subpaths, SkScalar tol) {
     if (tol < gMinCurveTol) {
         tol = gMinCurveTol;
     }
@@ -183,7 +181,7 @@ int GrPathUtils::worstCasePointCount(const SkPath& path, int* subpaths,
             case SkPath::kConic_Verb: {
                 SkScalar weight = iter.conicWeight();
                 SkAutoConicToQuads converter;
-                const SkPoint* quadPts = converter.computeQuads(pts, weight, 0.25f);
+                const SkPoint* quadPts = converter.computeQuads(pts, weight, tol);
                 for (int i = 0; i < converter.countQuads(); ++i) {
                     pointCount += quadraticPointCount(quadPts + 2*i, tol);
                 }