aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Stephen White <senorblanco@chromium.org>2018-03-28 14:41:22 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-29 14:28:55 +0000
commit20010e80b637b9c6173c2d3d3c2070bb3b184104 (patch)
tree59c6ae565ba2416f94dc35bd8c8b613af8a591c2
parent16c5d1b0225a80b505e7bf27a075eb07c994a9c0 (diff)
Reland "GrTessellator: hang fix."
This is a reland of 050c86768a2c24c62655f53ef9b685d40477eccb Original change's description: > GrTessellator: hang fix. > > Some edges are not coincident with their own endpoints (because floating > point). If this happens for an edge which is a right-enclosing-edge > during the Bentley-Ottman simplify() pass, we end up an infinite loop > attempting to split the edge, since the edge is never to the right of its > endpoint. > > The easiest fix is to simply remove the right-enclosing-edge splitting > code. This code was originally added before we had proper > active-edge-list rewinding, and should no longer be necessary. > > BUG=802896 > > Change-Id: Id9f2942b73f01152af8c0088e8c6b1389891d827 > Reviewed-on: https://skia-review.googlesource.com/116920 > Reviewed-by: Robert Phillips <robertphillips@google.com> > Commit-Queue: Stephen White <senorblanco@chromium.org> Bug: 802896 Change-Id: I3e48346a8a358ae7d481299a586003e817a519ca Reviewed-on: https://skia-review.googlesource.com/117121 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Mike Klein <mtklein@chromium.org>
-rw-r--r--src/gpu/GrTessellator.cpp6
-rw-r--r--tests/TessellatingPathRendererTests.cpp22
2 files changed, 22 insertions, 6 deletions
diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp
index 00e5c8a21c..b8ec6551c9 100644
--- a/src/gpu/GrTessellator.cpp
+++ b/src/gpu/GrTessellator.cpp
@@ -1421,12 +1421,6 @@ bool simplify(VertexList* mesh, Comparator& c, SkArenaAlloc& alloc) {
LOG("\nvertex %g: (%g,%g), alpha %d\n", v->fID, v->fPoint.fX, v->fPoint.fY, v->fAlpha);
restartChecks = false;
find_enclosing_edges(v, &activeEdges, &leftEnclosingEdge, &rightEnclosingEdge);
- if (rightEnclosingEdge && !rightEnclosingEdge->isRightOf(v)) {
- split_edge(rightEnclosingEdge, v, &activeEdges, &v, c, alloc);
- restartChecks = true;
- continue;
- }
- SkASSERT(!rightEnclosingEdge || rightEnclosingEdge->isRightOf(v));
v->fLeftEnclosingEdge = leftEnclosingEdge;
v->fRightEnclosingEdge = rightEnclosingEdge;
if (v->fFirstEdgeBelow) {
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index 451391762d..035b3fe323 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -439,6 +439,27 @@ static SkPath create_path_29() {
return path;
}
+// A path which hangs during simplification. It produces an edge which is
+// to the left of its own endpoints, which causes an infinte loop in the
+// right-enclosing-edge splitting.
+static SkPath create_path_30() {
+ SkPath path;
+ path.moveTo(0.75001740455627441406, 23.051967620849609375);
+ path.lineTo(5.8471612930297851562, 22.731662750244140625);
+ path.lineTo(10.749670028686523438, 22.253145217895507812);
+ path.lineTo(13.115868568420410156, 22.180681228637695312);
+ path.lineTo(15.418928146362304688, 22.340015411376953125);
+ path.lineTo( 17.654022216796875, 22.82159423828125);
+ path.lineTo(19.81632232666015625, 23.715869903564453125);
+ path.lineTo(40, 0);
+ path.lineTo(5.5635203441547955577e-15, 0);
+ path.lineTo(5.5635203441547955577e-15, 47);
+ path.lineTo(-1.4210854715202003717e-14, 21.713298797607421875);
+ path.lineTo(0.75001740455627441406, 21.694292068481445312);
+ path.lineTo(0.75001740455627441406, 23.051967620849609375);
+ return path;
+}
+
static std::unique_ptr<GrFragmentProcessor> create_linear_gradient_processor(GrContext* ctx) {
SkPoint pts[2] = { {0, 0}, {1, 1} };
@@ -529,5 +550,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
test_path(ctx, rtc.get(), create_path_27(), SkMatrix(), GrAAType::kCoverage);
test_path(ctx, rtc.get(), create_path_28(), SkMatrix(), GrAAType::kCoverage);
test_path(ctx, rtc.get(), create_path_29());
+ test_path(ctx, rtc.get(), create_path_30());
}
#endif