From d26b4d865ac57d1b5ef810dd4408d8cc147b3460 Mon Sep 17 00:00:00 2001 From: Stephen White Date: Thu, 26 Jul 2018 10:02:27 -0400 Subject: GrTessellator: fix for collinear edge merging. In some cases, two edges can be collinear when tested on one side (e.g., left top vs right edge), but non-collinear when tested on the other (e.g., right top vs left edge). We were actually merging based on one criterion, but assserting based on the other. The safest fix is to merge if either condition is true, and then assert that both conditions are false. Bug: 866319 Change-Id: Ia1be330caf62f6d7961746752f73993ca098d0a3 Reviewed-on: https://skia-review.googlesource.com/143501 Reviewed-by: Robert Phillips Commit-Queue: Stephen White --- tests/TessellatingPathRendererTests.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index ae20171b04..6b1f29fc80 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -616,6 +616,20 @@ static SkPath create_path_42() { return path; } +// Reduction from crbug.com/866319. Cause is edges that are collinear when tested from +// one side, but non-collinear when tested from the other. +static SkPath create_path_43() { + SkPath path; + path.moveTo( 307316821852160, -28808363114496); + path.lineTo( 307165222928384, -28794154909696); + path.lineTo( 307013691113472, -28779948802048); + path.lineTo( 306862159298560, -28765744791552); + path.lineTo( 306870313025536, -28766508154880); + path.lineTo( 307049695019008, -28783327313920); + path.lineTo( 307408660332544, -28816974020608); + return path; +} + static std::unique_ptr create_linear_gradient_processor(GrContext* ctx) { SkPoint pts[2] = { {0, 0}, {1, 1} }; @@ -718,4 +732,5 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { test_path(ctx, rtc.get(), create_path_40()); test_path(ctx, rtc.get(), create_path_41(), SkMatrix(), GrAAType::kCoverage); test_path(ctx, rtc.get(), create_path_42()); + test_path(ctx, rtc.get(), create_path_43(), SkMatrix(), GrAAType::kCoverage); } -- cgit v1.2.3