From 3f5301b284f195305371657801b1fc167a7f2671 Mon Sep 17 00:00:00 2001 From: Stephen White Date: Tue, 15 Aug 2017 17:01:15 -0400 Subject: GrTessellator: fix for collinear out-of-range intersections. Change 3b5a3fa8b1c11d4bd4499b040311f4c3553ebf8c introduced support for out-of-range intersections, which is necessary when the top and bottom vertices of an edge differ by only one ULP in the primary sort order and can't be split in-order. However, some out-of-range intersections produce edges which cancel each other out on splitting, in particular when the intersection is collinear with the newly-computed edge. This undoes the effect of the split. The tessellator then rewinds, re-detects the intersection, resplits, an infinite loop. The fix is to check for out-of-range intersections which are also collinear, and ignore them. This is ok, because these are not the cases we care about it change 3b5a3f above, which are never collinear. Bug: 753867 Change-Id: I590231e0e6f19c98f1ccf46cb7acc8a63ba35a9d Reviewed-on: https://skia-review.googlesource.com/34925 Reviewed-by: Brian Salomon Commit-Queue: Stephen White --- tests/TessellatingPathRendererTests.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/TessellatingPathRendererTests.cpp') diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index f8b69839aa..dbb328e3e3 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -347,6 +347,21 @@ static SkPath create_path_22() { return path; } +// A path which contains out-of-range colinear intersections. +static SkPath create_path_23() { + SkPath path; + path.moveTo( 0, 63.39080047607421875); + path.lineTo(-0.70804601907730102539, 63.14350128173828125); + path.lineTo(-7.8608899287380243391e-17, 64.14080047607421875); + path.moveTo( 0, 64.14080047607421875); + path.lineTo(44.285900115966796875, 64.14080047607421875); + path.lineTo( 0, 62.64080047607421875); + path.moveTo(21.434900283813476562, -0.24732701480388641357); + path.lineTo(-0.70804601907730102539, 63.14350128173828125); + path.lineTo(0.70804601907730102539, 63.6381988525390625); + return path; +} + static std::unique_ptr create_linear_gradient_processor(GrContext* ctx) { SkPoint pts[2] = { {0, 0}, {1, 1} }; SkColor colors[2] = { SK_ColorGREEN, SK_ColorBLUE }; @@ -427,5 +442,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { test_path(ctx, rtc.get(), create_path_20(), SkMatrix(), GrAAType::kCoverage); test_path(ctx, rtc.get(), create_path_21(), SkMatrix(), GrAAType::kCoverage); test_path(ctx, rtc.get(), create_path_22()); + test_path(ctx, rtc.get(), create_path_23()); } #endif -- cgit v1.2.3