Fix point count computation in tessellating path renderer.
The conic, quadratic and cubic computations were using tolerance^2 instead of tolerance when computing maximum point count, causing paths to be undertessellated when magnifying and overtessellated when minifying. (Funny story: this bug went unnoticed back when we were tessellating paths in screen space, when tolerance and its square were both 1.) BUG=skia:3731 Review URL: https://codereview.chromium.org/1095773003
This commit is contained in:
parent
a8ec4805db
commit
6d88bdb6f1
@ -565,7 +565,7 @@ void path_to_contours(const SkPath& path, SkScalar tolerance, const SkRect& clip
|
|||||||
SkScalar weight = iter.conicWeight();
|
SkScalar weight = iter.conicWeight();
|
||||||
const SkPoint* quadPts = converter.computeQuads(pts, weight, toleranceSqd);
|
const SkPoint* quadPts = converter.computeQuads(pts, weight, toleranceSqd);
|
||||||
for (int i = 0; i < converter.countQuads(); ++i) {
|
for (int i = 0; i < converter.countQuads(); ++i) {
|
||||||
int pointsLeft = GrPathUtils::quadraticPointCount(quadPts, toleranceSqd);
|
int pointsLeft = GrPathUtils::quadraticPointCount(quadPts, tolerance);
|
||||||
prev = generate_quadratic_points(quadPts[0], quadPts[1], quadPts[2],
|
prev = generate_quadratic_points(quadPts[0], quadPts[1], quadPts[2],
|
||||||
toleranceSqd, prev, &head, pointsLeft, alloc);
|
toleranceSqd, prev, &head, pointsLeft, alloc);
|
||||||
quadPts += 2;
|
quadPts += 2;
|
||||||
@ -586,13 +586,13 @@ void path_to_contours(const SkPath& path, SkScalar tolerance, const SkRect& clip
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SkPath::kQuad_Verb: {
|
case SkPath::kQuad_Verb: {
|
||||||
int pointsLeft = GrPathUtils::quadraticPointCount(pts, toleranceSqd);
|
int pointsLeft = GrPathUtils::quadraticPointCount(pts, tolerance);
|
||||||
prev = generate_quadratic_points(pts[0], pts[1], pts[2], toleranceSqd, prev,
|
prev = generate_quadratic_points(pts[0], pts[1], pts[2], toleranceSqd, prev,
|
||||||
&head, pointsLeft, alloc);
|
&head, pointsLeft, alloc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SkPath::kCubic_Verb: {
|
case SkPath::kCubic_Verb: {
|
||||||
int pointsLeft = GrPathUtils::cubicPointCount(pts, toleranceSqd);
|
int pointsLeft = GrPathUtils::cubicPointCount(pts, tolerance);
|
||||||
prev = generate_cubic_points(pts[0], pts[1], pts[2], pts[3],
|
prev = generate_cubic_points(pts[0], pts[1], pts[2], pts[3],
|
||||||
toleranceSqd, prev, &head, pointsLeft, alloc);
|
toleranceSqd, prev, &head, pointsLeft, alloc);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user