| Index: src/effects/SkDashPathEffect.cpp
|
| diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp
|
| index 38164999159176a59bc49baf7930179b02309fd9..ced0aab69a9930efbbd216127f776dd5d8c2770d 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(-1)
|
| + , fInitialDashLength(0)
|
| , fInitialDashIndex(0)
|
| , fIntervalLength(0) {
|
| SkASSERT(intervals);
|
| @@ -23,6 +23,7 @@
|
| fIntervals = (SkScalar*)sk_malloc_throw(sizeof(SkScalar) * count);
|
| fCount = count;
|
| for (int i = 0; i < count; i++) {
|
| + SkASSERT(intervals[i] >= 0);
|
| fIntervals[i] = intervals[i];
|
| }
|
|
|
| @@ -37,7 +38,7 @@
|
|
|
| bool SkDashPathEffect::filterPath(SkPath* dst, const SkPath& src,
|
| SkStrokeRec* rec, const SkRect* cullRect) const {
|
| - return SkDashPath::InternalFilter(dst, src, rec, cullRect, fIntervals, fCount,
|
| + return SkDashPath::FilterDashPath(dst, src, rec, cullRect, fIntervals, fCount,
|
| fInitialDashLength, fInitialDashIndex, fIntervalLength);
|
| }
|
|
|
| @@ -161,7 +162,7 @@
|
| const SkMatrix& matrix,
|
| const SkRect* cullRect) const {
|
| // width < 0 -> fill && width == 0 -> hairline so requiring width > 0 rules both out
|
| - if (0 >= rec.getWidth()) {
|
| + if (fInitialDashLength < 0 || 0 >= rec.getWidth()) {
|
| return false;
|
| }
|
|
|
| @@ -387,8 +388,13 @@
|
| //////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
| SkPathEffect* SkDashPathEffect::Create(const SkScalar intervals[], int count, SkScalar phase) {
|
| - if (!SkDashPath::ValidDashPath(phase, intervals, count)) {
|
| + if ((count < 2) || !SkIsAlign2(count)) {
|
| return nullptr;
|
| }
|
| + for (int i = 0; i < count; i++) {
|
| + if (intervals[i] < 0) {
|
| + return nullptr;
|
| + }
|
| + }
|
| return new SkDashPathEffect(intervals, count, phase);
|
| }
|
|
|