aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathUtils.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-12-08 05:19:12 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-08 05:19:12 -0800
commitf08ce6cd53c5607ed068f755036b062a8693a8dc (patch)
tree3c8716646068134dfe37a6f6cb2b0b4ca1e6af7f /src/gpu/GrPathUtils.cpp
parent57eecc154e20b454ad2f889049670fe386f038da (diff)
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
Diffstat (limited to 'src/gpu/GrPathUtils.cpp')
-rw-r--r--src/gpu/GrPathUtils.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp
index 21d115569b..f97a61e1f6 100644
--- a/src/gpu/GrPathUtils.cpp
+++ b/src/gpu/GrPathUtils.cpp
@@ -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];
}