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/GrGpu.cpp b/src/gpu/GrGpu.cpp
index b32c56a..b0ce7fe 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -371,45 +371,18 @@
fGeomPoolStateStack.pop_back();
}
-void GrGpu::onDrawIndexed(GrPrimitiveType type,
- int startVertex,
- int startIndex,
- int vertexCount,
- int indexCount) {
-
+void GrGpu::onDraw(const DrawInfo& info) {
this->handleDirtyContext();
-
- if (!this->setupClipAndFlushState(PrimTypeToDrawType(type))) {
+ if (!this->setupClipAndFlushState(PrimTypeToDrawType(info.primitiveType()))) {
return;
}
-
- int sVertex = startVertex;
- int sIndex = startIndex;
- setupGeometry(&sVertex, &sIndex, vertexCount, indexCount);
-
- this->onGpuDrawIndexed(type, sVertex, sIndex,
- vertexCount, indexCount);
-}
-
-void GrGpu::onDrawNonIndexed(GrPrimitiveType type,
- int startVertex,
- int vertexCount) {
- this->handleDirtyContext();
-
- if (!this->setupClipAndFlushState(PrimTypeToDrawType(type))) {
- return;
- }
-
- int sVertex = startVertex;
- setupGeometry(&sVertex, NULL, vertexCount, 0);
-
- this->onGpuDrawNonIndexed(type, sVertex, vertexCount);
+ this->onGpuDraw(info);
}
void GrGpu::onStencilPath(const GrPath* path, const SkStrokeRec&, SkPath::FillType fill) {
this->handleDirtyContext();
- // TODO: make this more effecient (don't copy and copy back)
+ // TODO: make this more efficient (don't copy and copy back)
GrAutoTRestore<GrStencilSettings> asr(this->drawState()->stencil());
this->setStencilPathSettings(*path, fill, this->drawState()->stencil());