diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp index 0ced572ba4..a40bfb402b 100644 --- a/src/gpu/GrTessellator.cpp +++ b/src/gpu/GrTessellator.cpp @@ -1267,6 +1267,11 @@ void simplify(const VertexList& vertices, Comparator& c, SkArenaAlloc& alloc) { do { restartChecks = false; find_enclosing_edges(v, &activeEdges, &leftEnclosingEdge, &rightEnclosingEdge); + if (rightEnclosingEdge && !rightEnclosingEdge->isRightOf(v)) { + split_edge(rightEnclosingEdge, v, &activeEdges, c, alloc); + restartChecks = true; + continue; + } if (v->fFirstEdgeBelow) { for (Edge* edge = v->fFirstEdgeBelow; edge; edge = edge->fNextEdgeBelow) { if (check_for_intersection(edge, leftEnclosingEdge, &activeEdges, c, alloc)) { @@ -1395,7 +1400,6 @@ Poly* tessellate(const VertexList& vertices, SkArenaAlloc& alloc) { } for (Edge* e = v->fFirstEdgeAbove; e != v->fLastEdgeAbove; e = e->fNextEdgeAbove) { Edge* rightEdge = e->fNextEdgeAbove; - SkASSERT(rightEdge->isRightOf(e->fTop)); remove_edge(e, &activeEdges); if (e->fRightPoly) { e->fRightPoly->addEdge(e, Poly::kLeft_Side, alloc); diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index 162dd7ea80..79385af956 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -261,6 +261,19 @@ static SkPath create_path_17() { 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 create_linear_gradient_processor(GrContext* ctx) { SkPoint pts[2] = { {0, 0}, {1, 1} }; SkColor colors[2] = { SK_ColorGREEN, SK_ColorBLUE }; @@ -335,5 +348,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { SkMatrix nonInvertibleMatrix = SkMatrix::MakeScale(0, 0); sk_sp 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