diff options
author | 2016-03-09 08:37:23 -0800 | |
---|---|---|
committer | 2016-03-09 08:37:23 -0800 | |
commit | 7f229ed827d1dc5897acfa87d84b642ce34b678f (patch) | |
tree | 7b7440d923a7004990de36e927fbd29845842584 | |
parent | e94ea625fbce6979b7ef59255c7598e81d37f546 (diff) |
Revert of don't create zero length intervals (patchset #1 id:1 of https://codereview.chromium.org/1766243004/ )
Reason for revert:
This may, or may not, be blocking the DEPS roll with:
svg/W3C-SVG-1.1/painting-stroke-04-t.svg
- LayoutSVGPath {path} at (50,127) size 380x26 [stroke={[type=SOLID] [color=#000000] [stroke width=25.00] [dash offset=10.00] [dash array={10.00, 10.00}]}] [data="M 50 140 L 430 140"]
+ LayoutSVGPath {path} at (60,127) size 370x26 [stroke={[type=SOLID] [color=#000000] [stroke width=25.00] [dash offset=10.00] [dash array={10.00, 10.00}]}] [data="M 50 140 L 430 140"]
Original issue's description:
> 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
>
> Committed: https://skia.googlesource.com/skia/+/18bbd00190623fb6cdb119df4a118ac3c1aed52a
TBR=reed@google.com,fmalita@chromium.org,caryclark@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=591993
Review URL: https://codereview.chromium.org/1779803002
-rw-r--r-- | gm/bug530095.cpp | 13 | ||||
-rw-r--r-- | src/utils/SkDashPath.cpp | 7 |
2 files changed, 3 insertions, 17 deletions
diff --git a/gm/bug530095.cpp b/gm/bug530095.cpp index 76f6bc8f2e..690da3c9d0 100644 --- a/gm/bug530095.cpp +++ b/gm/bug530095.cpp @@ -46,16 +46,3 @@ DEF_SIMPLE_GM(bug530095, canvas, 900, 1200) { canvas->translate(4, 4); canvas->drawPath(path2, paint); } - -DEF_SIMPLE_GM(bug591993, canvas, 40, 140) { - SkPaint p; - p.setColor(SK_ColorRED); - p.setAntiAlias(true); - p.setStyle(SkPaint::kStroke_Style); - p.setStrokeCap(SkPaint::kRound_Cap); - p.setStrokeWidth(10); - SkScalar intervals[] = { 100, 100 }; - SkPathEffect* dash = SkDashPathEffect::Create(intervals, SK_ARRAY_COUNT(intervals), 100); - p.setPathEffect(dash)->unref(); - canvas->drawLine(20, 20, 120, 20, p); -} diff --git a/src/utils/SkDashPath.cpp b/src/utils/SkDashPath.cpp index 0d2783eba2..cd01a9972b 100644 --- a/src/utils/SkDashPath.cpp +++ b/src/utils/SkDashPath.cpp @@ -16,12 +16,11 @@ 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) { - SkScalar gap = intervals[i]; - if (phase > gap || (phase == gap && gap)) { - phase -= gap; + if (phase > intervals[i]) { + phase -= intervals[i]; } else { *index = i; - return gap - phase; + return intervals[i] - phase; } } // If we get here, phase "appears" to be larger than our length. This |