Index: src/pathops/SkDQuadLineIntersection.cpp |
diff --git a/src/pathops/SkDQuadLineIntersection.cpp b/src/pathops/SkDQuadLineIntersection.cpp |
index 58b3060ab3db63b372dde8419d9f03ddd5f51312..b335c5a4b28465210de0e6c98a251e5fe213aff4 100644 |
--- a/src/pathops/SkDQuadLineIntersection.cpp |
+++ b/src/pathops/SkDQuadLineIntersection.cpp |
@@ -137,6 +137,9 @@ public: |
int intersect() { |
addExactEndPoints(); |
+ if (fAllowNear) { |
+ addNearEndPoints(); |
+ } |
double rootVals[2]; |
int roots = intersectRay(rootVals); |
for (int index = 0; index < roots; ++index) { |
@@ -147,9 +150,6 @@ public: |
fIntersections->insert(quadT, lineT, pt); |
} |
} |
- if (fAllowNear) { |
- addNearEndPoints(); |
- } |
return fIntersections->used(); |
} |
@@ -165,6 +165,9 @@ public: |
int horizontalIntersect(double axisIntercept, double left, double right, bool flipped) { |
addExactHorizontalEndPoints(left, right, axisIntercept); |
+ if (fAllowNear) { |
+ addNearHorizontalEndPoints(left, right, axisIntercept); |
+ } |
double rootVals[2]; |
int roots = horizontalIntersect(axisIntercept, rootVals); |
for (int index = 0; index < roots; ++index) { |
@@ -175,9 +178,6 @@ public: |
fIntersections->insert(quadT, lineT, pt); |
} |
} |
- if (fAllowNear) { |
- addNearHorizontalEndPoints(left, right, axisIntercept); |
- } |
if (flipped) { |
fIntersections->flip(); |
} |
@@ -196,6 +196,9 @@ public: |
int verticalIntersect(double axisIntercept, double top, double bottom, bool flipped) { |
addExactVerticalEndPoints(top, bottom, axisIntercept); |
+ if (fAllowNear) { |
+ addNearVerticalEndPoints(top, bottom, axisIntercept); |
+ } |
double rootVals[2]; |
int roots = verticalIntersect(axisIntercept, rootVals); |
for (int index = 0; index < roots; ++index) { |
@@ -206,9 +209,6 @@ public: |
fIntersections->insert(quadT, lineT, pt); |
} |
} |
- if (fAllowNear) { |
- addNearVerticalEndPoints(top, bottom, axisIntercept); |
- } |
if (flipped) { |
fIntersections->flip(); |
} |
@@ -324,6 +324,17 @@ protected: |
} else if (ptSet == kPointUninitialized) { |
*pt = fQuad.ptAtT(qT); |
} |
+ SkPoint gridPt = pt->asSkPoint(); |
+ if (gridPt == fLine[0].asSkPoint()) { |
+ *lineT = 0; |
+ } else if (gridPt == fLine[1].asSkPoint()) { |
+ *lineT = 1; |
+ } |
+ if (gridPt == fQuad[0].asSkPoint()) { |
+ *quadT = 0; |
+ } else if (gridPt == fQuad[2].asSkPoint()) { |
+ *quadT = 1; |
+ } |
return true; |
} |