aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ops/GrOvalOpFactory.cpp
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-05-15 11:03:26 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-15 18:01:59 +0000
commitbca46e29e9f96999df0b38fb9359e71b73217c94 (patch)
tree0bd487809346776fccfee12540968cb23aa6cb7a /src/gpu/ops/GrOvalOpFactory.cpp
parent18e9484ad5b5755757dc6badb986017a088a9c6b (diff)
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>
Diffstat (limited to 'src/gpu/ops/GrOvalOpFactory.cpp')
-rw-r--r--src/gpu/ops/GrOvalOpFactory.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index f5cc2ec7f2..a8081826df 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -1096,14 +1096,9 @@ private:
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 @@ private:
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 @@ private:
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;