GrTessellator: fix event creation for dead boundary edges.

In some cases, an overlap boundary edge can be nulled out by the creation
of a skeleton edge. In that case, we should avoid trying to create
parallel edge events from that dead edge.

This required making the tessellator verb maximum verb count modifiable
at runtime for testing, since the test case has more than 10 vertices.

Also added more logging.

BUG: 966696
Change-Id: I429735999f6297655311485bc68d732b1c48bfce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216284
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp
index 0a0cef9..88049c8 100644
--- a/src/gpu/GrTessellator.cpp
+++ b/src/gpu/GrTessellator.cpp
@@ -538,16 +538,20 @@
     if (!v->fPartner) {
         return;
     }
+    Vertex* top = edge->fEdge->fTop;
+    Vertex* bottom = edge->fEdge->fBottom;
+    if (!top || !bottom ) {
+        return;
+    }
     Line line = edge->fEdge->fLine;
     line.fC = -(dest->fPoint.fX * line.fA  + dest->fPoint.fY * line.fB);
     Edge bisector(v, v->fPartner, 1, Edge::Type::kConnector);
     SkPoint p;
     uint8_t alpha = dest->fAlpha;
-    if (line.intersect(bisector.fLine, &p) && !c.sweep_lt(p, edge->fEdge->fTop->fPoint) &&
-                                              c.sweep_lt(p, edge->fEdge->fBottom->fPoint)) {
+    if (line.intersect(bisector.fLine, &p) && !c.sweep_lt(p, top->fPoint) &&
+                                               c.sweep_lt(p, bottom->fPoint)) {
         LOG("found p edge event for %g, %g (original %g -> %g), will collapse to %g,%g alpha %d\n",
-            dest->fID, v->fID, edge->fEdge->fTop->fID, edge->fEdge->fBottom->fID, p.fX, p.fY,
-            alpha);
+            dest->fID, v->fID, top->fID, bottom->fID, p.fX, p.fY, alpha);
         edge->fEvent = alloc.make<Event>(edge, p, alpha);
         events->push(edge->fEvent);
     }
@@ -1501,14 +1505,18 @@
 
 void dump_skel(const SSEdgeList& ssEdges) {
 #if LOGGING_ENABLED
-    LOG("skeleton:\n");
     for (SSEdge* edge : ssEdges) {
         if (edge->fEdge) {
-            LOG("skel edge %g -> %g (original %g -> %g)\n",
+            LOG("skel edge %g -> %g",
                 edge->fPrev->fVertex->fID,
-                edge->fNext->fVertex->fID,
-                edge->fEdge->fTop->fID,
-                edge->fEdge->fBottom->fID);
+                edge->fNext->fVertex->fID);
+            if (edge->fEdge->fTop && edge->fEdge->fBottom) {
+                LOG(" (original %g -> %g)\n",
+                    edge->fEdge->fTop->fID,
+                    edge->fEdge->fBottom->fID);
+            } else {
+                LOG("\n");
+            }
         }
     }
 #endif
@@ -1950,11 +1958,14 @@
     bool complex = events.size() > 0;
 
     LOG("\ncollapsing overlap regions\n");
+    LOG("skeleton before:\n");
+    dump_skel(ssEdges);
     while (events.size() > 0) {
         Event* event = events.top();
         events.pop();
         event->apply(mesh, c, &events, alloc);
     }
+    LOG("skeleton after:\n");
     dump_skel(ssEdges);
     for (SSEdge* edge : ssEdges) {
         if (Edge* e = edge->fEdge) {