Revert "Revert "Make PathGeoBuilder use consistent iterators.""

This reverts commit b4513213245c2550683236b3aae829c8f3086469.

Bug: chromium:788500
Change-Id: I6028b20770009b703f76ce2d9b451c561eaa705a
Reviewed-on: https://skia-review.googlesource.com/77582
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/gm/crbug_788500.cpp b/gm/crbug_788500.cpp
new file mode 100644
index 0000000..ba14673
--- /dev/null
+++ b/gm/crbug_788500.cpp
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkCanvas.h"
+#include "SkPaint.h"
+#include "SkPath.h"
+#include "gm.h"
+
+DEF_SIMPLE_GM(crbug_788500, canvas, 300, 300) {
+    SkPath path;
+    path.setFillType(SkPath::kEvenOdd_FillType);
+    path.moveTo(0, 0);
+    path.moveTo(245.5f, 98.5f);
+    path.cubicTo(245.5f, 98.5f, 242, 78, 260, 75);
+
+    SkPaint paint;
+    paint.setAntiAlias(true);
+    canvas->drawPath(path, paint);
+}
diff --git a/gn/gm.gni b/gn/gm.gni
index 6892406..de98f79 100644
--- a/gn/gm.gni
+++ b/gn/gm.gni
@@ -92,6 +92,7 @@
   "$_gm/convexpolyeffect.cpp",
   "$_gm/copyTo4444.cpp",
   "$_gm/crbug_691386.cpp",
+  "$_gm/crbug_788500.cpp",
   "$_gm/croppedrects.cpp",
   "$_gm/crosscontextimage.cpp",
   "$_gm/cubicpaths.cpp",
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index 4a9f0c2..d49e43e 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -180,7 +180,7 @@
         SkPath::Verb verb;
 
         SkPoint pts[4];
-        while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
+        while ((verb = iter.next(pts, false)) != SkPath::kDone_Verb) {
             if (SkPath::kMove_Verb == verb && !first) {
                 return true;
             }
@@ -265,7 +265,7 @@
         SkASSERT(vertexCount <= fVerticesInChunk);
         SkASSERT(indexCount <= fIndicesInChunk);
 
-        if (vertexCount > 0) {
+        if (this->isIndexed() ? SkToBool(indexCount) : SkToBool(vertexCount)) {
             if (!this->isIndexed()) {
                 fMesh.setNonIndexedNonInstanced(vertexCount);
             } else {