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/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index f5cc2ec..a808182 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -1096,14 +1096,9 @@
vertices += circle_type_to_vert_count(geom.fStroked) * vertexStride;
}
- GrMesh mesh;
- mesh.fPrimitiveType = kTriangles_GrPrimitiveType;
- mesh.fIndexBuffer.reset(indexBuffer);
- mesh.fIndexCount = fIndexCount;
- mesh.fBaseIndex = firstIndex;
- mesh.fVertexBuffer.reset(vertexBuffer);
- mesh.fVertexCount = fVertCount;
- mesh.fBaseVertex = firstVertex;
+ GrMesh mesh(kTriangles_GrPrimitiveType);
+ mesh.setIndexed(indexBuffer, fIndexCount, firstIndex);
+ mesh.setVertices(vertexBuffer, fVertCount, firstVertex);
target->draw(gp.get(), this->pipeline(), mesh);
}
@@ -2002,14 +1997,9 @@
currStartVertex += rrect_type_to_vert_count(args.fType);
}
- GrMesh mesh;
- mesh.fPrimitiveType = kTriangles_GrPrimitiveType;
- mesh.fIndexBuffer.reset(indexBuffer);
- mesh.fIndexCount = fIndexCount;
- mesh.fBaseIndex = firstIndex;
- mesh.fVertexBuffer.reset(vertexBuffer);
- mesh.fVertexCount = fVertCount;
- mesh.fBaseVertex = firstVertex;
+ GrMesh mesh(kTriangles_GrPrimitiveType);
+ mesh.setIndexed(indexBuffer, fIndexCount, firstIndex);
+ mesh.setVertices(vertexBuffer, fVertCount, firstVertex);
target->draw(gp.get(), this->pipeline(), mesh);
}
@@ -2195,10 +2185,10 @@
sk_sp<const GrBuffer> indexBuffer(ref_rrect_index_buffer(
fStroked ? kStroke_RRectType : kFill_RRectType, target->resourceProvider()));
- PatternHelper helper;
+ PatternHelper helper(kTriangles_GrPrimitiveType);
EllipseVertex* verts = reinterpret_cast<EllipseVertex*>(
- helper.init(target, kTriangles_GrPrimitiveType, vertexStride, indexBuffer.get(),
- kVertsPerStandardRRect, indicesPerInstance, instanceCount));
+ helper.init(target, vertexStride, indexBuffer.get(), kVertsPerStandardRRect,
+ indicesPerInstance, instanceCount));
if (!verts || !indexBuffer) {
SkDebugf("Could not allocate vertices\n");
return;