GrTessellator: fix for vertex coincident with enclosing edge.
If a previously-enclosing edge coincides exactly with the current
vertex, there are no two adjacent edges which enclose the vertex.
Since find_enclosing_edges() ensures that the left enclosing edge
is to the left of the vertex, the fix is to split the right
enclosing edge on the current vertex and restart intersection
tests.
Bug: 716720
Change-Id: Id26c5b92a6d6139f348e99554638cded37e81a8e
Reviewed-on: https://skia-review.googlesource.com/15261
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index 162dd7e..79385af 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -261,6 +261,19 @@
return path;
}
+// A shape with a vertex collinear to the right hand edge.
+// This messes up find_enclosing_edges.
+static SkPath create_path_18() {
+ SkPath path;
+ path.moveTo(80, 20);
+ path.lineTo(80, 60);
+ path.lineTo(20, 60);
+ path.moveTo(80, 50);
+ path.lineTo(80, 80);
+ path.lineTo(20, 80);
+ return path;
+}
+
static sk_sp<GrFragmentProcessor> create_linear_gradient_processor(GrContext* ctx) {
SkPoint pts[2] = { {0, 0}, {1, 1} };
SkColor colors[2] = { SK_ColorGREEN, SK_ColorBLUE };
@@ -335,5 +348,6 @@
SkMatrix nonInvertibleMatrix = SkMatrix::MakeScale(0, 0);
sk_sp<GrFragmentProcessor> fp(create_linear_gradient_processor(ctx));
test_path(ctx, rtc.get(), create_path_17(), nonInvertibleMatrix, GrAAType::kCoverage, fp);
+ test_path(ctx, rtc.get(), create_path_18());
}
#endif