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

Unified Diff: src/pathops/SkOpSegment.cpp

Issue 607913007: fail on extremely large coincident curves (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | « src/pathops/SkOpSegment.h ('k') | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkOpSegment.cpp
diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp
index 2dda11a3836e57e4c1919823bc71da2fa557e64c..95046e2fd2d3da7b8b1aafc085392c5a26f16707 100644
--- a/src/pathops/SkOpSegment.cpp
+++ b/src/pathops/SkOpSegment.cpp
@@ -1211,7 +1211,7 @@ void SkOpSegment::bumpCoincidentBlind(bool binary, int index, int endIndex) {
} while (++index < endIndex);
}
-void SkOpSegment::bumpCoincidentThis(const SkOpSpan& oTest, bool binary, int* indexPtr,
+bool SkOpSegment::bumpCoincidentThis(const SkOpSpan& oTest, bool binary, int* indexPtr,
SkTArray<SkPoint, true>* outsideTs) {
int index = *indexPtr;
int oWindValue = oTest.fWindValue;
@@ -1223,12 +1223,16 @@ void SkOpSegment::bumpCoincidentThis(const SkOpSpan& oTest, bool binary, int* in
SkOpSpan* end = test;
const SkPoint& oStartPt = oTest.fPt;
do {
+ if (end->fDone && !end->fTiny && !end->fSmall) { // extremely large paths trigger this
+ return false;
+ }
if (bumpSpan(end, oWindValue, oOppValue)) {
TrackOutside(outsideTs, oStartPt);
}
end = &fTs[++index];
} while ((end->fPt == test->fPt || precisely_equal(end->fT, test->fT)) && end->fT < 1);
*indexPtr = index;
+ return true;
}
void SkOpSegment::bumpCoincidentOBlind(int index, int endIndex) {
@@ -1329,10 +1333,14 @@ bool SkOpSegment::addTCoincident(const SkPoint& startPt, const SkPoint& endPt, d
} while (*oTestPt == other->fTs[oIndex].fPt);
} else {
if (!binary || test->fWindValue + oTest->fOppValue >= 0) {
- bumpCoincidentThis(*oTest, binary, &index, &outsidePts);
+ if (!bumpCoincidentThis(*oTest, binary, &index, &outsidePts)) {
+ return false;
+ }
other->bumpCoincidentOther(*test, &oIndex, &oOutsidePts);
} else {
- other->bumpCoincidentThis(*test, binary, &oIndex, &oOutsidePts);
+ if (!other->bumpCoincidentThis(*test, binary, &oIndex, &oOutsidePts)) {
+ return false;
+ }
bumpCoincidentOther(*oTest, &index, &outsidePts);
}
}
@@ -1396,7 +1404,9 @@ bool SkOpSegment::addTCoincident(const SkPoint& startPt, const SkPoint& endPt, d
if (!binary || test->fWindValue + oTest->fOppValue >= 0) {
other->bumpCoincidentOther(*test, &oIndex, &oOutsidePts);
} else {
- other->bumpCoincidentThis(*test, binary, &oIndex, &oOutsidePts);
+ if (!other->bumpCoincidentThis(*test, binary, &oIndex, &oOutsidePts)) {
+ return false;
+ }
}
oTest = &other->fTs[oIndex];
oTestPt = &oTest->fPt;
« no previous file with comments | « src/pathops/SkOpSegment.h ('k') | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698