Allow Tessellator to operate on provided GrQuads

To facilitate this, the GrQuadBuffer::Iter's local GrQuads that are
modified on each next() are now allowed to be operated on for the AA
inset/outsetting. Previously this required additional GrQuads on the
stack to hold the results, and additional guards for accessing localQuad()
when the entry didn't have actual coords.

With this change, a 2D op should have its device and src GrQuads' Ws
set to 1 once, and then they are completely ignored for all iteration
and tessellation, without any more redundant initialization. In all
likelihood we won't see the needle move on powerful platforms, but may
help lower end devices.

Change-Id: I457205786766403a760918e779d36ba056d69cde
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256097
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/ops/GrQuadPerEdgeAA.h b/src/gpu/ops/GrQuadPerEdgeAA.h
index 8a77fa7..35a18fd 100644
--- a/src/gpu/ops/GrQuadPerEdgeAA.h
+++ b/src/gpu/ops/GrQuadPerEdgeAA.h
@@ -139,8 +139,10 @@
 
         // Calculates (as needed) inset and outset geometry for anti-aliasing, and appends all
         // necessary position and vertex attributes required by this Tessellator's VertexSpec into
-        // the 'vertices' the Tessellator was called with.
-        void append(const GrQuad& deviceQuad, const GrQuad& localQuad,
+        // the 'vertices' the Tessellator was called with. The insetting and outsetting may
+        // damage the provided GrQuads (as this is intended to work with GrQuadBuffer::Iter).
+        // 'localQuad' can be null if the VertexSpec does not use local coords.
+        void append(GrQuad* deviceQuad, GrQuad* localQuad,
                     const SkPMColor4f& color, const SkRect& uvDomain, GrQuadAAFlags aaFlags);
 
         SkDEBUGCODE(char* vertices() const { return (char*) fVertexWriter.fPtr; })
@@ -151,7 +153,7 @@
         // specs that appear in the wild far more frequently, so they use explicit WriteQuadProcs
         // that have no branches.
         typedef void (*WriteQuadProc)(GrVertexWriter* vertices, const VertexSpec& spec,
-                                      const GrQuad& deviceQuad, const GrQuad& localQuad,
+                                      const GrQuad* deviceQuad, const GrQuad* localQuad,
                                       const float coverage[4], const SkPMColor4f& color,
                                       const SkRect& geomDomain, const SkRect& texDomain);
         static WriteQuadProc GetWriteQuadProc(const VertexSpec& spec);