aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-09-22 05:15:04 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-22 05:15:04 -0700
commitd1d628120af11c022e88265e9bdd27eb7d5d1eb8 (patch)
tree4d2ae899711146ca1bf120bca57b354a040b9295 /src/core
parentd7a9db644496785100c4e61add1c9f8ed0494408 (diff)
speed up debug dm
SkPathMeasure can take minutes with pathological cases. Limit the debug check to a reasonable number. R=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2356343004 Review-Url: https://codereview.chromium.org/2356343004
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkPathMeasure.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/SkPathMeasure.cpp b/src/core/SkPathMeasure.cpp
index b8026746ce..8582bc2b73 100644
--- a/src/core/SkPathMeasure.cpp
+++ b/src/core/SkPathMeasure.cpp
@@ -407,14 +407,15 @@ void SkPathMeasure::buildSegments() {
const Segment* stop = fSegments.end();
unsigned ptIndex = 0;
SkScalar distance = 0;
-
+ // limit the loop to a reasonable number; pathological cases can run for minutes
+ int maxChecks = 10000000; // set to INT_MAX to defeat the check
while (seg < stop) {
SkASSERT(seg->fDistance > distance);
SkASSERT(seg->fPtIndex >= ptIndex);
SkASSERT(seg->fTValue > 0);
const Segment* s = seg;
- while (s < stop - 1 && s[0].fPtIndex == s[1].fPtIndex) {
+ while (s < stop - 1 && s[0].fPtIndex == s[1].fPtIndex && --maxChecks > 0) {
SkASSERT(s[0].fType == s[1].fType);
SkASSERT(s[0].fTValue < s[1].fTValue);
s += 1;