aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-06-29 12:27:48 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-29 16:56:49 +0000
commit5fb30566b40c2d936341dd6187c94e5ab00f4c58 (patch)
tree61275d0c8569d9a7d149f1aa3bc695c20258aed6 /src/gpu
parentb8d88d72cbe9cc3dde91eaf58e928b34748526a7 (diff)
Fix gpu dashing for case when circle dashes are large enough to overlap
Bug: skia: Change-Id: I7153b28103c5ca0947c37d57357b64bf2aa884e5 Reviewed-on: https://skia-review.googlesource.com/20979 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/ops/GrDashOp.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index dda9fa21c0..544484fd34 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -53,9 +53,16 @@ bool GrDashOp::CanDrawDashLine(const SkPoint pts[2], const GrStyle& style,
}
SkPaint::Cap cap = style.strokeRec().getCap();
- // Current we do don't handle Round or Square cap dashes
- if (SkPaint::kRound_Cap == cap && intervals[0] != 0.f) {
- return false;
+ if (SkPaint::kRound_Cap == cap) {
+ // Current we don't support round caps unless the on interval is zero
+ if (intervals[0] != 0.f) {
+ return false;
+ }
+ // If the width of the circle caps in greater than the off interval we will pick up unwanted
+ // segments of circles at the start and end of the dash line.
+ if (style.strokeRec().getWidth() > intervals[1]) {
+ return false;
+ }
}
return true;
@@ -137,9 +144,6 @@ static SkScalar calc_end_adjustment(const SkScalar intervals[2], const SkPoint p
*endingInt = srcIntervalLen;
}
if (*endingInt > intervals[0]) {
- if (0 == intervals[0]) {
- *endingInt -= 0.01f; // make sure we capture the last zero size pnt (used if has caps)
- }
return *endingInt - intervals[0];
}
return 0;