Convert stroke tessellation to using GrVertexWriter

Bug: chromium:1172543
Bug: skia:10419
Change-Id: Ie2d05b0d37e03e8cd3eb69c67da89c02ffa49ddb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367576
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrVertexWriter.h b/src/gpu/GrVertexWriter.h
index a7403ed..e5f6685 100644
--- a/src/gpu/GrVertexWriter.h
+++ b/src/gpu/GrVertexWriter.h
@@ -25,6 +25,28 @@
 struct GrVertexWriter {
     void* fPtr;
 
+    GrVertexWriter() = default;
+    GrVertexWriter(void* ptr) : fPtr(ptr) {}
+    GrVertexWriter(const GrVertexWriter&) = delete;
+    GrVertexWriter(GrVertexWriter&& that) { *this = std::move(that); }
+
+    GrVertexWriter& operator=(const GrVertexWriter&) = delete;
+    GrVertexWriter& operator=(GrVertexWriter&& that) {
+        fPtr = that.fPtr;
+        that.fPtr = nullptr;
+        return *this;
+    }
+
+    bool operator==(const GrVertexWriter& that) {
+        return fPtr == that.fPtr;
+    }
+
+    bool isValid() const { return fPtr != nullptr; }
+
+    GrVertexWriter makeOffset(size_t offsetInBytes) const {
+        return {SkTAddOffset<void>(fPtr, offsetInBytes)};
+    }
+
     template <typename T>
     class Conditional {
     public:
@@ -99,6 +121,21 @@
         this->write(remainder...);
     }
 
+    template <typename T>
+    void writeArray(const T* array, int count) {
+        static_assert(std::is_pod<T>::value, "");
+        static_assert(alignof(T) <= 4, "");
+        memcpy(fPtr, array, count * sizeof(T));
+        fPtr = SkTAddOffset<void>(fPtr, count * sizeof(T));
+    }
+
+    template <typename T>
+    void fill(const T& val, int repeatCount) {
+        for (int i = 0; i < repeatCount; ++i) {
+            this->write(val);
+        }
+    }
+
     void writeRaw(const void* data, size_t size) {
         memcpy(fPtr, data, size);
         fPtr = SkTAddOffset<void>(fPtr, size);