Add GrDrawTarget::DrawInfo, combine API for performing indexed/non-indexed draws in subclasses.
Review URL: https://codereview.appspot.com/7237045
git-svn-id: http://skia.googlecode.com/svn/trunk@7466 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 3898426..d2d1d8d 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -341,20 +341,28 @@
void GrDrawTarget::drawIndexed(GrPrimitiveType type, int startVertex,
int startIndex, int vertexCount,
int indexCount) {
- if (indexCount > 0 &&
- this->checkDraw(type, startVertex, startIndex,
- vertexCount, indexCount)) {
- this->onDrawIndexed(type, startVertex, startIndex,
- vertexCount, indexCount);
+ if (indexCount > 0 && this->checkDraw(type, startVertex, startIndex, vertexCount, indexCount)) {
+ DrawInfo info;
+ info.fPrimitiveType = type;
+ info.fStartVertex = startVertex;
+ info.fStartIndex = startIndex;
+ info.fVertexCount = vertexCount;
+ info.fIndexCount = indexCount;
+ this->onDraw(info);
}
}
void GrDrawTarget::drawNonIndexed(GrPrimitiveType type,
int startVertex,
int vertexCount) {
- if (vertexCount > 0 &&
- this->checkDraw(type, startVertex, -1, vertexCount, -1)) {
- this->onDrawNonIndexed(type, startVertex, vertexCount);
+ if (vertexCount > 0 && this->checkDraw(type, startVertex, -1, vertexCount, -1)) {
+ DrawInfo info;
+ info.fPrimitiveType = type;
+ info.fStartVertex = startVertex;
+ info.fStartIndex = 0;
+ info.fVertexCount = vertexCount;
+ info.fIndexCount = 0;
+ this->onDraw(info);
}
}