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>
This commit is contained in:
parent
b8d88d72cb
commit
5fb30566b4
@ -332,7 +332,7 @@ protected:
|
||||
return SkString("dashing4");
|
||||
}
|
||||
|
||||
SkISize onISize() { return SkISize::Make(640, 950); }
|
||||
SkISize onISize() { return SkISize::Make(640, 1050); }
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
constexpr struct {
|
||||
@ -397,6 +397,18 @@ protected:
|
||||
drawline(canvas, 32, 16, paint, 8.f, 0.f, 40.f);
|
||||
canvas->translate(0, SkIntToScalar(20));
|
||||
}
|
||||
|
||||
// Test overlapping circles.
|
||||
canvas->translate(SkIntToScalar(5), SkIntToScalar(20));
|
||||
paint.setAntiAlias(true);
|
||||
paint.setStrokeCap(SkPaint::kRound_Cap);
|
||||
paint.setColor(0x44000000);
|
||||
paint.setStrokeWidth(40);
|
||||
drawline(canvas, 0, 30, paint);
|
||||
|
||||
canvas->translate(0, SkIntToScalar(50));
|
||||
paint.setStrokeCap(SkPaint::kSquare_Cap);
|
||||
drawline(canvas, 0, 30, paint);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user