Index: src/effects/SkDashPathEffect.cpp |
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp |
index ced0aab69a9930efbbd216127f776dd5d8c2770d..7e7e48c7b3b54f15dd6141c611443488d29fe6f2 100644 |
--- a/src/effects/SkDashPathEffect.cpp |
+++ b/src/effects/SkDashPathEffect.cpp |
@@ -14,7 +14,7 @@ |
SkDashPathEffect::SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase) |
: fPhase(0) |
- , fInitialDashLength(0) |
+ , fInitialDashLength(-1) |
, fInitialDashIndex(0) |
, fIntervalLength(0) { |
SkASSERT(intervals); |
@@ -28,7 +28,7 @@ SkDashPathEffect::SkDashPathEffect(const SkScalar intervals[], int count, SkScal |
} |
// set the internal data members |
- SkDashPath::CalcDashParameters(phase, fIntervals, fCount, |
+ fValidParameters = SkDashPath::CalcDashParameters(phase, fIntervals, fCount, |
&fInitialDashLength, &fInitialDashIndex, &fIntervalLength, &fPhase); |
} |
@@ -38,6 +38,9 @@ SkDashPathEffect::~SkDashPathEffect() { |
bool SkDashPathEffect::filterPath(SkPath* dst, const SkPath& src, |
SkStrokeRec* rec, const SkRect* cullRect) const { |
+ if (!fValidParameters) { |
+ return false; |
+ } |
return SkDashPath::FilterDashPath(dst, src, rec, cullRect, fIntervals, fCount, |
fInitialDashLength, fInitialDashIndex, fIntervalLength); |
} |
@@ -162,7 +165,7 @@ bool SkDashPathEffect::asPoints(PointData* results, |
const SkMatrix& matrix, |
const SkRect* cullRect) const { |
// width < 0 -> fill && width == 0 -> hairline so requiring width > 0 rules both out |
- if (fInitialDashLength < 0 || 0 >= rec.getWidth()) { |
+ if (!fValidParameters || 0 >= rec.getWidth()) { |
return false; |
} |