aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-03-09 05:55:53 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-09 05:55:53 -0800
commit18bbd00190623fb6cdb119df4a118ac3c1aed52a (patch)
tree0510ab4de3f1d8d32f4870c2ef782d9f9df7fb11 /src
parent6ac97b7eb99c06107bb4536e1a888fce7837213a (diff)
don't create zero length intervals
Dashing a pattern without zero-length intervals should not create them if the end of the on interval coincides with the beginning of the initial dash offset. R=reed@google.com BUG=591993 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1766243004 Review URL: https://codereview.chromium.org/1766243004
Diffstat (limited to 'src')
-rw-r--r--src/utils/SkDashPath.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/utils/SkDashPath.cpp b/src/utils/SkDashPath.cpp
index cd01a9972b..0d2783eba2 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