diff options
author | 2017-06-30 10:36:38 -0400 | |
---|---|---|
committer | 2017-06-30 15:21:10 +0000 | |
commit | 95581bbba1d696f14de45e00dd0c09119377027f (patch) | |
tree | e1086cdda4b330064a920f96c65db0cf5e02799d | |
parent | d150e84352531f6422b792747cdc20874f80f0aa (diff) |
Allow caps on hairlines for gpu dashed lines
Bug: skia:
Change-Id: Ie3b61e0a308f7cbec65166f2f2ac4fe3cc5d16d0
Reviewed-on: https://skia-review.googlesource.com/21364
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
-rw-r--r-- | gm/dashing.cpp | 2 | ||||
-rw-r--r-- | src/gpu/ops/GrDashOp.cpp | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/gm/dashing.cpp b/gm/dashing.cpp index ff6e700b02..68fe7f168f 100644 --- a/gm/dashing.cpp +++ b/gm/dashing.cpp @@ -348,7 +348,7 @@ protected: paint.setStyle(SkPaint::kStroke_Style); canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); - canvas->translate(0, SK_ScalarHalf); + canvas->translate(SK_ScalarHalf, SK_ScalarHalf); for (int width = 0; width <= 2; ++width) { for (size_t data = 0; data < SK_ARRAY_COUNT(gData); ++data) { diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp index f354389542..cde033ce8b 100644 --- a/src/gpu/ops/GrDashOp.cpp +++ b/src/gpu/ops/GrDashOp.cpp @@ -199,7 +199,6 @@ static void setup_dashed_rect(const SkRect& rect, void* vertices, int idx, verts[idx + i].fRadius = radius; verts[idx + i].fCenterX = centerX; } - } else { SkASSERT(kNonRound_DashCap == cap && vertexStride == sizeof(DashLineVertex)); DashLineVertex* verts = reinterpret_cast<DashLineVertex*>(vertices); @@ -379,7 +378,7 @@ private: DashDraw& draw = draws.push_back(args); - bool hasCap = SkPaint::kButt_Cap != cap && 0 != args.fSrcStrokeWidth; + bool hasCap = SkPaint::kButt_Cap != cap; // We always want to at least stroke out half a pixel on each side in device space // so 0.5f / perpScale gives us this min in src space @@ -479,7 +478,7 @@ private: SkScalar halfDevStroke = strokeWidth * 0.5f; - if (SkPaint::kSquare_Cap == cap && 0 != args.fSrcStrokeWidth) { + if (SkPaint::kSquare_Cap == cap) { // add cap to on interval and remove from off interval devIntervals[0] += strokeWidth; devIntervals[1] -= strokeWidth; |