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
diff --git a/src/core/SkPathMeasure.cpp b/src/core/SkPathMeasure.cpp
index b802674..8582bc2 100644
--- a/src/core/SkPathMeasure.cpp
+++ b/src/core/SkPathMeasure.cpp
@@ -407,14 +407,15 @@
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;