From 739641580fe6c17534a73a2cd903e7e854a1ba27 Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Sun, 21 Jan 2018 10:26:46 -0500 Subject: [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 Commit-Queue: Florin Malita --- experimental/sksg/SkSGDraw.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'experimental') 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) { -- cgit v1.2.3