From 2f4686fa25ef7a14961f68be18e63de3567d0a15 Mon Sep 17 00:00:00 2001 From: Stephen White Date: Tue, 3 Jan 2017 16:20:01 -0500 Subject: Quality and performance fixes for AA tessellating path renderer. Use quads rather than triangles for the edge geometry. This allows us to perform a simpler edge categorization (see below). It also improves performance by reducing the number of edges processed during the simplify and tessellate steps. Label AA edges as three types: inner, outer, and connector. This results in correct alpha values for intersected edges, even when the top or bottom vertex has been merged with a vertex on edges of different types. Changed the "collinear edges" sample from the concavepaths GM for a "fast-foward" shape, which more clearly shows the problem being fixed here. (The collinearity from the "collinear edges" was actually being removed earlier up the stack, causing the path to become convex and not exercise the concave path renderers anyway.) NOTE: this will cause changes in the "concavepaths" GM results, and minor pixel diffs in a number of other tests. Change-Id: I6c2b0cdb35cda42b01cf1100621271fef5be35b0 Reviewed-on: https://skia-review.googlesource.com/6430 Reviewed-by: Stephan White Commit-Queue: Stephan White --- gm/concavepaths.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'gm/concavepaths.cpp') diff --git a/gm/concavepaths.cpp b/gm/concavepaths.cpp index ad87d255ca..c68265b99f 100644 --- a/gm/concavepaths.cpp +++ b/gm/concavepaths.cpp @@ -80,15 +80,18 @@ void test_fish(SkCanvas* canvas, const SkPaint& paint) { canvas->restore(); } -// Collinear edges -void test_collinear_edges(SkCanvas* canvas, const SkPaint& paint) { +// Overlapping "Fast-forward" icon: tests coincidence of inner and outer +// vertices generated by intersection. +void test_fast_forward(SkCanvas* canvas, const SkPaint& paint) { SkPath path; canvas->save(); canvas->translate(100, 100); path.moveTo(SkIntToScalar(20), SkIntToScalar(20)); - path.lineTo(SkIntToScalar(50), SkIntToScalar(20)); - path.lineTo(SkIntToScalar(80), SkIntToScalar(20)); - path.lineTo(SkIntToScalar(50), SkIntToScalar(80)); + path.lineTo(SkIntToScalar(60), SkIntToScalar(50)); + path.lineTo(SkIntToScalar(20), SkIntToScalar(80)); + path.moveTo(SkIntToScalar(40), SkIntToScalar(20)); + path.lineTo(SkIntToScalar(40), SkIntToScalar(80)); + path.lineTo(SkIntToScalar(80), SkIntToScalar(50)); canvas->drawPath(path, paint); canvas->restore(); } @@ -384,7 +387,7 @@ protected: test_bowtie(canvas, paint); test_fake_bowtie(canvas, paint); test_fish(canvas, paint); - test_collinear_edges(canvas, paint); + test_fast_forward(canvas, paint); test_hole(canvas, paint); test_star(canvas, paint); test_stairstep(canvas, paint); -- cgit v1.2.3