Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Unified Diff: src/gpu/GrPathUtils.cpp

Issue 1504983003: Loosen check for zero vectors in GrPathUtils::convert_noninflect_cubic_to_quads (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPathUtils.cpp
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp
index 21d115569b495776a3e22ac4a9e2696df7e6f9cf..f97a61e1f60f202942d94ea913b4e98a50b48bf0 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];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698