From 53a0298de3de8f7b2f2299675b91ae293724d37d Mon Sep 17 00:00:00 2001 From: Stephen White Date: Wed, 30 May 2018 22:47:46 -0400 Subject: GrTessellator: fix for ping-pong split fuzzer hang. When support for out-of-range intersections was added in 3b5a3fa8b1c11d4bd4499b040311f4c3553ebf8c, it was intended to support splitting edges that are almost flat, where merging with the top or bottom vertex would cause visual artifacts. However, it triggers too often for other, non-nearly-flat cases, causing simplify() to loop infinitely. The fix is to support out-of-range intersections only if they differ by 1/2 machine epsilon. This also generalizes the out_of_range_and_collinear() check, so it was removed. Bug: 838978 Change-Id: I238f2b90e4b7ad647ecf072427ee38726e549581 Reviewed-on: https://skia-review.googlesource.com/130458 Reviewed-by: Stephen White --- tests/TessellatingPathRendererTests.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests/TessellatingPathRendererTests.cpp') diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index 00f43985dd..086d2e546c 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -502,6 +502,29 @@ static SkPath create_path_33() { return path; } +// From crbug.com/844873. Hangs repeatedly splitting alternate vertices. +static SkPath create_path_34() { + SkPath path; + path.moveTo(10, -1e+20f); + path.lineTo(11, 25000); + path.lineTo(10, 25000); + path.lineTo(11, 25010); + return path; +} + +// Reduction from circular_arcs_stroke_and_fill_round GM which +// repeatedly splits on the opposite edge from case 34 above. +static SkPath create_path_35() { + SkPath path; + path.moveTo( 16.25, 26.495191574096679688); + path.lineTo(32.420825958251953125, 37.377376556396484375); + path.lineTo(25.176382064819335938, 39.31851959228515625); + path.moveTo( 20, 20); + path.lineTo(28.847436904907226562, 37.940830230712890625); + path.lineTo(25.17638397216796875, 39.31851959228515625); + return path; +} + static std::unique_ptr create_linear_gradient_processor(GrContext* ctx) { SkPoint pts[2] = { {0, 0}, {1, 1} }; @@ -595,5 +618,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { test_path(ctx, rtc.get(), create_path_31(), SkMatrix(), GrAAType::kCoverage); test_path(ctx, rtc.get(), create_path_32()); test_path(ctx, rtc.get(), create_path_33()); + test_path(ctx, rtc.get(), create_path_34()); + test_path(ctx, rtc.get(), create_path_35()); } #endif -- cgit v1.2.3