diff options
author | Stephen White <senorblanco@chromium.org> | 2017-12-19 18:09:54 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-21 20:51:27 +0000 |
commit | e260c46bbfe0e15e5b3d4a964484cc07b161b59a (patch) | |
tree | ca2e854af3367e6edaa0fa84f4230a1bbc9e4f0c /tests/TessellatingPathRendererTests.cpp | |
parent | 87bd7646e94a3437aceaf5b97bbaa8b02eb1cc65 (diff) |
GrTessellator: implement straight skeleton, phase 2.
This CL implements two major changes to the AA tessellating path
renderer:
1) Fix inverted edges after stroke and simplify. Instead of detecting
and fixing edges which invert on stroking during the stroking pass, we
run the full simplify pass on both inner and outer contours, then
create edge collapse events for the overlap regions. We then process
the edge events in a priority queue and process them in order of decreasing
alpha (this is the "edge event" part of the straight skeleton
algorithm). By doing it after simplification, we ensure that
there's a full-alpha intersection vertex to join the collapse edge
to (which may have <1 alpha), so no spurious gradients appear in
the rendered path.
2) "Pointy" vertices (defined as those which meet at an acute angle less
than 14 degrees) are now properly bevelled off during stroking.
This removes antialiasing artifacts which extend beyond the path
boundary.
Some ancillary changes:
The extracted boundaries which are input to stroking have their line
equations pre-normalized, and multiplied by winding. This simplifies
a lot of code which was performing this computation on the fly.
The workaround for the "intruding vertex" problem was removed, since the
straight skeleton now moves the intruding vertex before it can cause
problems.
Bug: 756823
Change-Id: I271ed32be6847da55273b387e8c04bbf9b512b70
Reviewed-on: https://skia-review.googlesource.com/87341
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Diffstat (limited to 'tests/TessellatingPathRendererTests.cpp')
-rw-r--r-- | tests/TessellatingPathRendererTests.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index b622f3767a..42629457f2 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -374,7 +374,40 @@ static SkPath create_path_24() { return path; } +// An edge collapse event which also collapses a neighbour, requiring +// its event to be removed. +static SkPath create_path_25() { + SkPath path; + path.moveTo( 43.44110107421875, 148.15106201171875); + path.lineTo( 44.64471435546875, 148.16748046875); + path.lineTo( 46.35009765625, 147.403076171875); + path.lineTo( 46.45404052734375, 148.34906005859375); + path.lineTo( 45.0400390625, 148.54205322265625); + path.lineTo( 44.624053955078125, 148.9810791015625); + path.lineTo( 44.59405517578125, 149.16107177734375); + path.lineTo( 44.877044677734375, 149.62005615234375); + path.lineTo(144.373016357421875, 68.8070068359375); + return path; +} + +// An edge collapse event causes an edge to become collinear, requiring +// its event to be removed. +static SkPath create_path_26() { + SkPath path; + path.moveTo( 43.44110107421875, 148.15106201171875); + path.lineTo( 44.64471435546875, 148.16748046875); + path.lineTo( 46.35009765625, 147.403076171875); + path.lineTo( 46.45404052734375, 148.34906005859375); + path.lineTo( 45.0400390625, 148.54205322265625); + path.lineTo( 44.624053955078125, 148.9810791015625); + path.lineTo( 44.59405517578125, 149.16107177734375); + path.lineTo( 44.877044677734375, 149.62005615234375); + path.lineTo(144.373016357421875, 68.8070068359375); + return path; +} + static std::unique_ptr<GrFragmentProcessor> create_linear_gradient_processor(GrContext* ctx) { + SkPoint pts[2] = { {0, 0}, {1, 1} }; SkColor colors[2] = { SK_ColorGREEN, SK_ColorBLUE }; sk_sp<SkShader> shader = SkGradientShader::MakeLinear( @@ -460,5 +493,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { test_path(ctx, rtc.get(), create_path_22()); test_path(ctx, rtc.get(), create_path_23()); test_path(ctx, rtc.get(), create_path_24()); + test_path(ctx, rtc.get(), create_path_25(), SkMatrix(), GrAAType::kCoverage); + test_path(ctx, rtc.get(), create_path_26(), SkMatrix(), GrAAType::kCoverage); } #endif |