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

Unified Diff: src/pathops/SkDLineIntersection.cpp

Issue 400033002: update pathops core and tests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix uninitialized variable Created 6 years, 5 months 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 | « gyp/pathops_unittest.gyp ('k') | src/pathops/SkOpSegment.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « gyp/pathops_unittest.gyp ('k') | src/pathops/SkOpSegment.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698