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

Unified Diff: src/pathops/SkPathOpsCubic.cpp

Issue 2176733002: limit number of searched roots (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « no previous file | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsCubic.cpp
diff --git a/src/pathops/SkPathOpsCubic.cpp b/src/pathops/SkPathOpsCubic.cpp
index 7fd3dd235d52762d8fa9514984d18bf7afcb7972..6fcb348e4ff8fdad349989e9ca218ea70437bbcd 100644
--- a/src/pathops/SkPathOpsCubic.cpp
+++ b/src/pathops/SkPathOpsCubic.cpp
@@ -310,6 +310,7 @@ int SkDCubic::searchRoots(double extremeTs[6], int extrema, double axisIntercept
extrema += findInflections(&extremeTs[extrema]);
extremeTs[extrema++] = 0;
extremeTs[extrema] = 1;
+ SkASSERT(extrema < 6);
SkTQSort(extremeTs, extremeTs + extrema);
int validCount = 0;
for (int index = 0; index < extrema; ) {
@@ -320,6 +321,9 @@ int SkDCubic::searchRoots(double extremeTs[6], int extrema, double axisIntercept
}
double newT = binarySearch(min, max, axisIntercept, xAxis);
if (newT >= 0) {
+ if (validCount >= 3) {
+ return 0;
+ }
validRoots[validCount++] = newT;
}
}
« no previous file with comments | « no previous file | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698