Index: src/pathops/SkPathOpsLine.cpp |
diff --git a/src/pathops/SkPathOpsLine.cpp b/src/pathops/SkPathOpsLine.cpp |
index cad54eb263ad3b90351c96daf4da8a7e9b266887..6fa091db8ebdfa0578c16e7256a0daaac6b16d5c 100644 |
--- a/src/pathops/SkPathOpsLine.cpp |
+++ b/src/pathops/SkPathOpsLine.cpp |
@@ -41,6 +41,9 @@ double SkDLine::nearPoint(const SkDPoint& xy, bool* unequal) const { |
if (!between(0, numer, denom)) { |
return -1; |
} |
+ if (!denom) { |
+ return 0; |
+ } |
double t = numer / denom; |
SkDPoint realPt = ptAtT(t); |
double dist = realPt.distance(xy); // OPTIMIZATION: can we compare against distSq instead ? |
@@ -48,7 +51,7 @@ double SkDLine::nearPoint(const SkDPoint& xy, bool* unequal) const { |
double tiniest = SkTMin(SkTMin(SkTMin(fPts[0].fX, fPts[0].fY), fPts[1].fX), fPts[1].fY); |
double largest = SkTMax(SkTMax(SkTMax(fPts[0].fX, fPts[0].fY), fPts[1].fX), fPts[1].fY); |
largest = SkTMax(largest, -tiniest); |
- if (!AlmostEqualUlps(largest, largest + dist)) { // is the dist within ULPS tolerance? |
+ if (!AlmostEqualUlps_Pin(largest, largest + dist)) { // is the dist within ULPS tolerance? |
return -1; |
} |
if (unequal) { |