diff options
author | Florin Malita <fmalita@chromium.org> | 2018-01-21 10:26:46 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-21 16:13:11 +0000 |
commit | 739641580fe6c17534a73a2cd903e7e854a1ba27 (patch) | |
tree | 3cad01ca5ee8cb1443d32917151ae44a1e5685f2 | |
parent | b7235a9b73d1c4c48f75d80961756be603e36686 (diff) |
[sksg] Skip zero-width strokes
Zero-width strokes imply hairline in Skia, but in other models (e.g.
Lottie) they are simply ignored. The latter approach avoids
discontinuities when width -> 0, so let's make it the default for sksg.
TBR=
Change-Id: I957a873c0e6468e21372115ed18cc7316fd2e7d1
Reviewed-on: https://skia-review.googlesource.com/97661
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
-rw-r--r-- | experimental/sksg/SkSGDraw.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/experimental/sksg/SkSGDraw.cpp b/experimental/sksg/SkSGDraw.cpp index 14f844a359..33c73a5b2b 100644 --- a/experimental/sksg/SkSGDraw.cpp +++ b/experimental/sksg/SkSGDraw.cpp @@ -26,7 +26,13 @@ Draw::~Draw() { } void Draw::onRender(SkCanvas* canvas) const { - fGeometry->draw(canvas, fPaint->makePaint()); + const auto& paint = fPaint->makePaint(); + const auto skipDraw = paint.nothingToDraw() || + (paint.getStyle() == SkPaint::kStroke_Style && paint.getStrokeWidth() <= 0); + + if (!skipDraw) { + fGeometry->draw(canvas, paint); + } } SkRect Draw::onRevalidate(InvalidationController* ic, const SkMatrix& ctm) { |