diff options
author | 2018-01-09 11:49:08 -0500 | |
---|---|---|
committer | 2018-01-09 18:49:37 +0000 | |
commit | e40c3610e4b713eb652491b8524dd1d4db117c5a (patch) | |
tree | 5fc5655ac783b249410d3b7da32bb489762db40f /src/gpu/GrTessellator.cpp | |
parent | 9ff5dc9c9f222059a9e191b528fbb86999ecebf5 (diff) |
GrTessellator: set a cap on quadratic linearization.
Some pathological cases don't converge to a reasonable number of points
when using uniform linearization of quadratic points. Cap them to the
maximum which GrPathUtils supports.
Add reduced test case from crbug-762369.
BUG=762369
Change-Id: Icc744018e5c01a0e0fe2ec00613bdb25e49614e9
Reviewed-on: https://skia-review.googlesource.com/92721
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Diffstat (limited to 'src/gpu/GrTessellator.cpp')
-rw-r--r-- | src/gpu/GrTessellator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp index 3eb92a6479..888c7de445 100644 --- a/src/gpu/GrTessellator.cpp +++ b/src/gpu/GrTessellator.cpp @@ -711,10 +711,10 @@ void append_quadratic_to_contour(const SkPoint pts[3], SkScalar toleranceSqd, Ve Sk2s ab = quad.fA * quad.fB; SkScalar t = denom ? (-ab[0] - ab[1]) / denom : 0.0f; int nPoints = 1; - SkScalar u; + SkScalar u = 1.0f; // Test possible subdivision values only at the point of maximum curvature. // If it passes the flatness metric there, it'll pass everywhere. - for (;;) { + while (nPoints < GrPathUtils::kMaxPointsPerCurve) { u = 1.0f / nPoints; if (quad_error_at(pts, t, u) < toleranceSqd) { break; |