Add general quad factories to GrFillRectOp and GrTextureOp

Bug: skia:
Change-Id: I1f9e9013d20496554891b72749ed9b0844747566
Reviewed-on: https://skia-review.googlesource.com/c/191570
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/ops/GrFillRectOp.cpp b/src/gpu/ops/GrFillRectOp.cpp
index 8dcec21..1d4e13c 100644
--- a/src/gpu/ops/GrFillRectOp.cpp
+++ b/src/gpu/ops/GrFillRectOp.cpp
@@ -376,6 +376,25 @@
                             GrPerspQuad(localRect), GrQuadType::kRect);
 }
 
+std::unique_ptr<GrDrawOp> MakePerEdgeQuad(GrRecordingContext* context,
+                                          GrPaint&& paint,
+                                          GrAAType aaType,
+                                          GrQuadAAFlags edgeAA,
+                                          const SkMatrix& viewMatrix,
+                                          const SkPoint quad[4],
+                                          const SkPoint localQuad[4],
+                                          const GrUserStencilSettings* stencilSettings) {
+    // With arbitrary quads, the quad types are limited to kStandard or kPerspective (unless we
+    // analyzed the points, but callers have more knowledge and should've just use the appropriate
+    // factory, so assume they can't be rectilinear or simpler)
+    GrQuadType deviceType = viewMatrix.hasPerspective() ? GrQuadType::kPerspective
+                                                        : GrQuadType::kStandard;
+    return FillRectOp::Make(context, std::move(paint), aaType, edgeAA, stencilSettings,
+                            GrPerspQuad::MakeFromSkQuad(quad, viewMatrix), deviceType,
+                            GrPerspQuad::MakeFromSkQuad(localQuad ? localQuad : quad,
+                                                        SkMatrix::I()), GrQuadType::kStandard);
+}
+
 std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext* context,
                                   GrPaint&& paint,
                                   GrAAType aaType,