Convert GrMesh back to a class
Specific methods that limit the data to valid configurations are better
than a runtime mega-assert.
Bug: skia:
Change-Id: Ie15f2dc79659e44cfaddd16eb474795b110fda73
Reviewed-on: https://skia-review.googlesource.com/16577
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/ops/GrMeshDrawOp.h b/src/gpu/ops/GrMeshDrawOp.h
index 92a4c1e..178ca29 100644
--- a/src/gpu/ops/GrMeshDrawOp.h
+++ b/src/gpu/ops/GrMeshDrawOp.h
@@ -33,11 +33,11 @@
space for the vertices and flushes the draws to the GrMeshDrawOp::Target. */
class PatternHelper {
public:
- PatternHelper() {}
+ PatternHelper(GrPrimitiveType primitiveType) : fMesh(primitiveType) {}
/** Returns the allocated storage for the vertices. The caller should populate the vertices
before calling recordDraws(). */
- void* init(Target*, GrPrimitiveType, size_t vertexStride, const GrBuffer*,
- int verticesPerRepetition, int indicesPerRepetition, int repeatCount);
+ void* init(Target*, size_t vertexStride, const GrBuffer*, int verticesPerRepetition,
+ int indicesPerRepetition, int repeatCount);
/** Call after init() to issue draws to the GrMeshDrawOp::Target.*/
void recordDraw(Target*, const GrGeometryProcessor*, const GrPipeline*);
@@ -52,7 +52,7 @@
/** A specialization of InstanceHelper for quad rendering. */
class QuadHelper : private PatternHelper {
public:
- QuadHelper() : INHERITED() {}
+ QuadHelper() : INHERITED(kTriangles_GrPrimitiveType) {}
/** Finds the cached quad index buffer and reserves vertex space. Returns nullptr on failure
and on success a pointer to the vertex data that the caller should populate before
calling recordDraws(). */