Index: src/pathops/SkDCubicLineIntersection.cpp |
diff --git a/src/pathops/SkDCubicLineIntersection.cpp b/src/pathops/SkDCubicLineIntersection.cpp |
index da4b983d457049b4a82f7975187acbf30881d910..aadc15a5ba55877a3f3946c56dfad9bca9a3f467 100644 |
--- a/src/pathops/SkDCubicLineIntersection.cpp |
+++ b/src/pathops/SkDCubicLineIntersection.cpp |
@@ -146,11 +146,22 @@ public: |
return fIntersections->used(); |
} |
- int horizontalIntersect(double axisIntercept, double roots[3]) { |
+ int horizontalIntersect(double axisIntercept, double validRoots[3]) { |
double A, B, C, D; |
SkDCubic::Coefficients(&fCubic[0].fY, &A, &B, &C, &D); |
D -= axisIntercept; |
- return SkDCubic::RootsValidT(A, B, C, D, roots); |
+ int realCount; |
+ double allRoots[3]; |
+ int validCount = SkDCubic::RootsValidT(A, B, C, D, allRoots, &realCount, validRoots); |
+ if (validCount >= 0) { |
+ return validCount; |
+ } |
+ SkDPoint calcPt = fCubic.ptAtT(validRoots[0]); |
+ if (approximately_equal(calcPt.fY, axisIntercept)) { |
+ return 1; |
+ } |
+ fCubic.searchRoots(allRoots, realCount, &validRoots[0], axisIntercept, false); |
+ return 1; |
} |
int horizontalIntersect(double axisIntercept, double left, double right, bool flipped) { |