Loosen check for zero vectors in GrPathUtils::convert_noninflect_cubic_to_quads
In the repro case the conic in question has a replicated control point at the end. These points end up being slightly different by the time they get to convert_noninflect_cubic_to_quads so the initial checks for a zero vector don't fire. The following checks, in the constrainWithinTangents path, do fire however leading to a premature termination of conversion to quads. BUG=skia:4611 Review URL: https://codereview.chromium.org/1504983003
This commit is contained in:
parent
57eecc154e
commit
f08ce6cd53
@ -133,10 +133,10 @@ uint32_t GrPathUtils::generateCubicPoints(const SkPoint& p0,
|
||||
if (pointsLeft < 2 ||
|
||||
(p1.distanceToLineSegmentBetweenSqd(p0, p3) < tolSqd &&
|
||||
p2.distanceToLineSegmentBetweenSqd(p0, p3) < tolSqd)) {
|
||||
(*points)[0] = p3;
|
||||
*points += 1;
|
||||
return 1;
|
||||
}
|
||||
(*points)[0] = p3;
|
||||
*points += 1;
|
||||
return 1;
|
||||
}
|
||||
SkPoint q[] = {
|
||||
{ SkScalarAve(p0.fX, p1.fX), SkScalarAve(p0.fY, p1.fY) },
|
||||
{ SkScalarAve(p1.fX, p2.fX), SkScalarAve(p1.fY, p2.fY) },
|
||||
@ -408,8 +408,8 @@ void convert_noninflect_cubic_to_quads(const SkPoint p[4],
|
||||
SkVector ab = p[1] - p[0];
|
||||
SkVector dc = p[2] - p[3];
|
||||
|
||||
if (ab.isZero()) {
|
||||
if (dc.isZero()) {
|
||||
if (ab.lengthSqd() < SK_ScalarNearlyZero) {
|
||||
if (dc.lengthSqd() < SK_ScalarNearlyZero) {
|
||||
SkPoint* degQuad = quads->push_back_n(3);
|
||||
degQuad[0] = p[0];
|
||||
degQuad[1] = p[0];
|
||||
@ -418,7 +418,7 @@ void convert_noninflect_cubic_to_quads(const SkPoint p[4],
|
||||
}
|
||||
ab = p[2] - p[0];
|
||||
}
|
||||
if (dc.isZero()) {
|
||||
if (dc.lengthSqd() < SK_ScalarNearlyZero) {
|
||||
dc = p[1] - p[3];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user