Don't batch circles and circular rrects beyond index limit

BUG=skia:6158, chromium:690144, chromium:688582, chromium:684112

Change-Id: I7a6d1fb73cbe6cb4328848acd153ff2505b5fea2
Reviewed-on: https://skia-review.googlesource.com/8256
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index 2f50bb4..4c00189 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -1103,6 +1103,12 @@
 
     bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
         CircleOp* that = t->cast<CircleOp>();
+
+        // can only represent 65535 unique vertices with 16-bit indices
+        if (fVertCount + that->fVertCount > 65535) {
+            return false;
+        }
+
         if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
                                     that->bounds(), caps)) {
             return false;
@@ -1994,6 +2000,12 @@
 
     bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
         CircularRRectOp* that = t->cast<CircularRRectOp>();
+
+        // can only represent 65535 unique vertices with 16-bit indices
+        if (fVertCount + that->fVertCount > 65535) {
+            return false;
+        }
+
         if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
                                     that->bounds(), caps)) {
             return false;