Index: src/utils/SkDashPath.cpp |
diff --git a/src/utils/SkDashPath.cpp b/src/utils/SkDashPath.cpp |
index cd01a9972b94695e1a4b27e1e819bb675fcb56e0..0d2783eba257b35bef23ca56e7d71c8a51094bfc 100644 |
--- a/src/utils/SkDashPath.cpp |
+++ b/src/utils/SkDashPath.cpp |
@@ -16,11 +16,12 @@ static inline int is_even(int x) { |
static SkScalar find_first_interval(const SkScalar intervals[], SkScalar phase, |
int32_t* index, int count) { |
for (int i = 0; i < count; ++i) { |
- if (phase > intervals[i]) { |
- phase -= intervals[i]; |
+ SkScalar gap = intervals[i]; |
+ if (phase > gap || (phase == gap && gap)) { |
+ phase -= gap; |
} else { |
*index = i; |
- return intervals[i] - phase; |
+ return gap - phase; |
} |
} |
// If we get here, phase "appears" to be larger than our length. This |