Index: src/pathops/SkDLineIntersection.cpp |
diff --git a/src/pathops/SkDLineIntersection.cpp b/src/pathops/SkDLineIntersection.cpp |
index 9ae0107173926e923b1936fd883d1953377ebd18..b209474066bde4865da3e2fa27e1c6a004c265c2 100644 |
--- a/src/pathops/SkDLineIntersection.cpp |
+++ b/src/pathops/SkDLineIntersection.cpp |
@@ -173,21 +173,24 @@ int SkIntersections::intersect(const SkDLine& a, const SkDLine& b) { |
nearCount += t >= 0; |
} |
if (nearCount > 0) { |
- for (int iA = 0; iA < 2; ++iA) { |
- if (!aNotB[iA]) { |
- continue; |
- } |
- int nearer = aNearB[iA] > 0.5; |
- if (!bNotA[nearer]) { |
- continue; |
+ // Skip if each segment contributes to one end point. |
+ if (nearCount != 2 || aNotB[0] == aNotB[1]) { |
+ for (int iA = 0; iA < 2; ++iA) { |
+ if (!aNotB[iA]) { |
+ continue; |
+ } |
+ int nearer = aNearB[iA] > 0.5; |
+ if (!bNotA[nearer]) { |
+ continue; |
+ } |
+ SkASSERT(a[iA] != b[nearer]); |
+ SkASSERT(iA == (bNearA[nearer] > 0.5)); |
+ fNearlySame[iA] = true; |
+ insertNear(iA, nearer, a[iA], b[nearer]); |
+ aNearB[iA] = -1; |
+ bNearA[nearer] = -1; |
+ nearCount -= 2; |
} |
- SkASSERT(a[iA] != b[nearer]); |
- SkASSERT(iA == (bNearA[nearer] > 0.5)); |
- fNearlySame[iA] = true; |
- insertNear(iA, nearer, a[iA], b[nearer]); |
- aNearB[iA] = -1; |
- bNearA[nearer] = -1; |
- nearCount -= 2; |
} |
if (nearCount > 0) { |
for (int iA = 0; iA < 2; ++iA) { |