From 5fb30566b40c2d936341dd6187c94e5ab00f4c58 Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Thu, 29 Jun 2017 12:27:48 -0400 Subject: 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 Reviewed-by: Robert Phillips --- src/gpu/ops/GrDashOp.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/gpu') 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; -- cgit v1.2.3