Respect max index buffer sizes in GrFillRectOp::MakeSet

This is required before we can lower the max AA quad count (again).

Bug: b/143572065 skia:9601
Change-Id: Iea5884ffff9bd62f62527fcb597dac97d33ecd76
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254438
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/ops/GrFillRectOp.h b/src/gpu/ops/GrFillRectOp.h
index 768ed8b..600e87b 100644
--- a/src/gpu/ops/GrFillRectOp.h
+++ b/src/gpu/ops/GrFillRectOp.h
@@ -25,34 +25,53 @@
  * the GrPaint is only consumed by these methods if a valid op is returned. If null is returned then
  * the paint is unmodified and may still be used.
  */
-namespace GrFillRectOp {
+class GrFillRectOp {
+public:
 
-std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
-                               GrPaint&& paint,
-                               GrAAType aaType,
-                               GrQuadAAFlags aaFlags,
-                               const GrQuad& deviceQuad,
-                               const GrQuad& localQuad,
-                               const GrUserStencilSettings* stencil = nullptr);
+    static std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
+                                          GrPaint&& paint,
+                                          GrAAType aaType,
+                                          GrQuadAAFlags aaFlags,
+                                          const GrQuad& deviceQuad,
+                                          const GrQuad& localQuad,
+                                          const GrUserStencilSettings* stencil = nullptr);
 
-// Utility function to create a non-AA rect transformed by view. This is used commonly enough in
-// testing and GMs that manage ops without going through GrRTC that it's worth the convenience.
-std::unique_ptr<GrDrawOp> MakeNonAARect(GrRecordingContext* context,
-                                        GrPaint&& paint,
-                                        const SkMatrix& view,
-                                        const SkRect& rect,
-                                        const GrUserStencilSettings* stencil = nullptr);
+    // Utility function to create a non-AA rect transformed by view. This is used commonly enough
+    // in testing and GMs that manage ops without going through GrRTC that it's worth the
+    // convenience.
+    static std::unique_ptr<GrDrawOp> MakeNonAARect(GrRecordingContext* context,
+                                                   GrPaint&& paint,
+                                                   const SkMatrix& view,
+                                                   const SkRect& rect,
+                                                   const GrUserStencilSettings* stencil = nullptr);
 
-// Bulk API for drawing quads with a single op
-// TODO(michaelludwig) - remove if the bulk API is not useful for SkiaRenderer
-std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext* context,
-                                  GrPaint&& paint,
-                                  GrAAType aaType,
-                                  const SkMatrix& viewMatrix,
-                                  const GrRenderTargetContext::QuadSetEntry quads[],
-                                  int quadCount,
-                                  const GrUserStencilSettings* stencil = nullptr);
+    // Bulk API for drawing quads with a single op
+    // TODO(michaelludwig) - remove if the bulk API is not useful for SkiaRenderer
+    static void AddFillRectOps(GrRenderTargetContext*,
+                               const GrClip& clip,
+                               GrRecordingContext*,
+                               GrPaint&&,
+                               GrAAType,
+                               const SkMatrix& viewMatrix,
+                               const GrRenderTargetContext::QuadSetEntry quads[],
+                               int quadCount,
+                               const GrUserStencilSettings* = nullptr);
 
-} // namespace GrFillRectOp
+#if GR_TEST_UTILS
+    static uint32_t ClassID();
+#endif
+
+private:
+    // Create a GrFillRectOp that uses as many quads as possible from 'quads' w/o exceeding
+    // any index buffer size limits.
+    static std::unique_ptr<GrDrawOp> MakeOp(GrRecordingContext*,
+                                            GrPaint&&,
+                                            GrAAType,
+                                            const SkMatrix& viewMatrix,
+                                            const GrRenderTargetContext::QuadSetEntry quads[],
+                                            int quadCount,
+                                            const GrUserStencilSettings*,
+                                            int* numConsumed);
+};
 
 #endif // GrFillRectOp_DEFINED