Reland "Track quad type on GrQuad directly"

This reverts commit 0dee19bacc00f327dca20cc7e4c0a97bc8082c0e.

Reason for revert: properly remember src quad type

Original change's description:
> Revert "Track quad type on GrQuad directly"
>
> This reverts commit 85766c4cd367596268588f53631a1c43376c929d.
>
> Reason for revert: red - so much red
>
> Original change's description:
> > Track quad type on GrQuad directly
> >
> > This makes subsequent higher-level drawing APIs more compact, and
> > shouldn't come with a performance hit. Everywhere we used to need
> > a GrPerspQuad, we'd also take the GrQuadType as a second argument.
> > The quad list types already deconstruct the quad so there's no
> > extra overhead in the op's memory usage.
> >
> > It also improves usability and decreases the likelihood that an
> > incorrect quad type is ever associated with the quad.
> >
> > Bug: skia:
> > Change-Id: Iba908fb133ad664744a5788a7088d90de0d3a1c2
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214820
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,michaelludwig@google.com
>
> Change-Id: Ied594673116fb901287b334fea41da3c71494fb1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215607
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,michaelludwig@google.com

Change-Id: Id5fb51218f2ace37086112caa2e43461d2f2b46b
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215640
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/ops/GrFillRectOp.cpp b/src/gpu/ops/GrFillRectOp.cpp
index 1889b0b..aad26c1 100644
--- a/src/gpu/ops/GrFillRectOp.cpp
+++ b/src/gpu/ops/GrFillRectOp.cpp
@@ -64,35 +64,32 @@
                                           GrQuadAAFlags edgeAA,
                                           const GrUserStencilSettings* stencilSettings,
                                           const GrPerspQuad& deviceQuad,
-                                          GrQuadType deviceQuadType,
-                                          const GrPerspQuad& localQuad,
-                                          GrQuadType localQuadType) {
+                                          const GrPerspQuad& localQuad) {
         // Clean up deviations between aaType and edgeAA
-        GrResolveAATypeForQuad(aaType, edgeAA, deviceQuad, deviceQuadType, &aaType, &edgeAA);
+        GrResolveAATypeForQuad(aaType, edgeAA, deviceQuad, &aaType, &edgeAA);
         return Helper::FactoryHelper<FillRectOp>(context, std::move(paint), aaType, edgeAA,
-                stencilSettings, deviceQuad, deviceQuadType, localQuad, localQuadType);
+                stencilSettings, deviceQuad, localQuad);
     }
 
     // aaType is passed to Helper in the initializer list, so incongruities between aaType and
     // edgeFlags must be resolved prior to calling this constructor.
     FillRectOp(Helper::MakeArgs args, SkPMColor4f paintColor, GrAAType aaType,
                GrQuadAAFlags edgeFlags, const GrUserStencilSettings* stencil,
-               const GrPerspQuad& deviceQuad, GrQuadType deviceQuadType,
-               const GrPerspQuad& localQuad, GrQuadType localQuadType)
+               const GrPerspQuad& deviceQuad, const GrPerspQuad& localQuad)
             : INHERITED(ClassID())
             , fHelper(args, aaType, stencil) {
         // The color stored with the quad is the clear color if a scissor-clear is decided upon
         // when executing the op.
-        fDeviceQuads.push_back(deviceQuad, deviceQuadType, { paintColor, edgeFlags });
+        fDeviceQuads.push_back(deviceQuad, { paintColor, edgeFlags });
 
         if (!fHelper.isTrivial()) {
             // Conservatively keep track of the local coordinates; it may be that the paint doesn't
             // need them after analysis is finished. If the paint is known to be solid up front they
             // can be skipped entirely.
-            fLocalQuads.push_back(localQuad, localQuadType);
+            fLocalQuads.push_back(localQuad);
         }
-        this->setBounds(deviceQuad.bounds(deviceQuadType),
-                        HasAABloat(aaType == GrAAType::kCoverage), IsZeroArea::kNo);
+        this->setBounds(deviceQuad.bounds(), HasAABloat(aaType == GrAAType::kCoverage),
+                        IsZeroArea::kNo);
     }
 
     const char* name() const override { return "FillRectOp"; }
@@ -297,8 +294,7 @@
     // used with quad sets, which uses the same view matrix for each quad so this assumes that the
     // device quad type of the new quad is the same as the op's.
     void addQuad(const GrPerspQuad& deviceQuad, const GrPerspQuad& localQuad,
-                 GrQuadType localQuadType, const SkPMColor4f& color, GrQuadAAFlags edgeAA,
-                 GrAAType aaType) {
+                 const SkPMColor4f& color, GrQuadAAFlags edgeAA, GrAAType aaType) {
         // The new quad's aa type should be the same as the first quad's or none, except when the
         // first quad's aa type was already downgraded to none, in which case the stored type must
         // be lifted to back to the requested type.
@@ -314,12 +310,12 @@
 
         // Update the bounds and add the quad to this op's storage
         SkRect newBounds = this->bounds();
-        newBounds.joinPossiblyEmptyRect(deviceQuad.bounds(fDeviceQuads.quadType()));
+        newBounds.joinPossiblyEmptyRect(deviceQuad.bounds());
         this->setBounds(newBounds, HasAABloat(fHelper.aaType() == GrAAType::kCoverage),
                         IsZeroArea::kNo);
-        fDeviceQuads.push_back(deviceQuad, fDeviceQuads.quadType(), { color, edgeAA });
+        fDeviceQuads.push_back(deviceQuad, { color, edgeAA });
         if (!fHelper.isTrivial()) {
-            fLocalQuads.push_back(localQuad, localQuadType);
+            fLocalQuads.push_back(localQuad);
         }
     }
 
@@ -356,10 +352,8 @@
                                       const SkMatrix& viewMatrix,
                                       const SkRect& rect,
                                       const GrUserStencilSettings* stencilSettings) {
-    GrQuadType dstQuadType = GrQuadTypeForTransformedRect(viewMatrix);
     return FillRectOp::Make(context, std::move(paint), aaType, edgeAA, stencilSettings,
-                            GrPerspQuad::MakeFromRect(rect, viewMatrix),  dstQuadType,
-                            GrPerspQuad(rect), GrQuadType::kRect);
+                            GrPerspQuad::MakeFromRect(rect, viewMatrix), GrPerspQuad(rect));
 }
 
 std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalMatrix(GrRecordingContext* context,
@@ -370,11 +364,9 @@
                                                      const SkMatrix& localMatrix,
                                                      const SkRect& rect,
                                                      const GrUserStencilSettings* stencilSettings) {
-    GrQuadType dstQuadType = GrQuadTypeForTransformedRect(viewMatrix);
-    GrQuadType localQuadType = GrQuadTypeForTransformedRect(localMatrix);
     return FillRectOp::Make(context, std::move(paint), aaType, edgeAA, stencilSettings,
-                            GrPerspQuad::MakeFromRect(rect, viewMatrix), dstQuadType,
-                            GrPerspQuad::MakeFromRect(rect, localMatrix), localQuadType);
+                            GrPerspQuad::MakeFromRect(rect, viewMatrix),
+                            GrPerspQuad::MakeFromRect(rect, localMatrix));
 }
 
 std::unique_ptr<GrDrawOp> MakePerEdgeWithLocalRect(GrRecordingContext* context,
@@ -385,10 +377,8 @@
                                                    const SkRect& rect,
                                                    const SkRect& localRect,
                                                    const GrUserStencilSettings* stencilSettings) {
-    GrQuadType dstQuadType = GrQuadTypeForTransformedRect(viewMatrix);
     return FillRectOp::Make(context, std::move(paint), aaType, edgeAA, stencilSettings,
-                            GrPerspQuad::MakeFromRect(rect, viewMatrix), dstQuadType,
-                            GrPerspQuad(localRect), GrQuadType::kRect);
+                            GrPerspQuad::MakeFromRect(rect, viewMatrix), GrPerspQuad(localRect));
 }
 
 std::unique_ptr<GrDrawOp> MakePerEdgeQuad(GrRecordingContext* context,
@@ -399,12 +389,10 @@
                                           const SkPoint quad[4],
                                           const SkPoint localQuad[4],
                                           const GrUserStencilSettings* stencilSettings) {
-    GrQuadType deviceType = GrQuadTypeForPoints(quad, viewMatrix);
-    GrQuadType localType = GrQuadTypeForPoints(localQuad ? localQuad : quad, SkMatrix::I());
     return FillRectOp::Make(context, std::move(paint), aaType, edgeAA, stencilSettings,
-                            GrPerspQuad::MakeFromSkQuad(quad, viewMatrix), deviceType,
+                            GrPerspQuad::MakeFromSkQuad(quad, viewMatrix),
                             GrPerspQuad::MakeFromSkQuad(localQuad ? localQuad : quad,
-                                                        SkMatrix::I()), localType);
+                                                        SkMatrix::I()));
 }
 
 std::unique_ptr<GrDrawOp> MakeSet(GrRecordingContext* context,
@@ -416,14 +404,12 @@
                                   const GrUserStencilSettings* stencilSettings) {
     // First make a draw op for the first quad in the set
     SkASSERT(cnt > 0);
-    GrQuadType deviceQuadType = GrQuadTypeForTransformedRect(viewMatrix);
 
     paint.setColor4f(quads[0].fColor);
     std::unique_ptr<GrDrawOp> op = FillRectOp::Make(context, std::move(paint), aaType,
             quads[0].fAAFlags, stencilSettings,
-            GrPerspQuad::MakeFromRect(quads[0].fRect, viewMatrix), deviceQuadType,
-            GrPerspQuad::MakeFromRect(quads[0].fRect, quads[0].fLocalMatrix),
-            GrQuadTypeForTransformedRect(quads[0].fLocalMatrix));
+            GrPerspQuad::MakeFromRect(quads[0].fRect, viewMatrix),
+            GrPerspQuad::MakeFromRect(quads[0].fRect, quads[0].fLocalMatrix));
     auto* fillRects = op->cast<FillRectOp>();
 
     // Accumulate remaining quads similar to onCombineIfPossible() without creating an op
@@ -432,13 +418,12 @@
 
         GrAAType resolvedAA;
         GrQuadAAFlags resolvedEdgeFlags;
-        GrResolveAATypeForQuad(aaType, quads[i].fAAFlags, deviceQuad, deviceQuadType,
+        GrResolveAATypeForQuad(aaType, quads[i].fAAFlags, deviceQuad,
                                &resolvedAA, &resolvedEdgeFlags);
 
         fillRects->addQuad(deviceQuad,
                            GrPerspQuad::MakeFromRect(quads[i].fRect, quads[i].fLocalMatrix),
-                           GrQuadTypeForTransformedRect(quads[i].fLocalMatrix), quads[i].fColor,
-                           resolvedEdgeFlags,resolvedAA);
+                           quads[i].fColor, resolvedEdgeFlags,resolvedAA);
     }
 
     return op;