Index: gm/convexpolyeffect.cpp |
diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp |
index 60b73c571d97a067d5b566d2ed0b88570dd65212..cd9b3d10e55b2efbc56efa0a49b6bf5aa2aaae67 100644 |
--- a/gm/convexpolyeffect.cpp |
+++ b/gm/convexpolyeffect.cpp |
@@ -17,7 +17,6 @@ |
#include "GrContext.h" |
#include "GrDefaultGeoProcFactory.h" |
#include "GrPathUtils.h" |
-#include "GrResourceProvider.h" |
#include "GrTest.h" |
#include "GrTestBatch.h" |
#include "SkColorPriv.h" |
@@ -53,47 +52,24 @@ private: |
} |
void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline) override { |
- SkAutoTUnref<const GrIndexBuffer> indexBuffer( |
- batchTarget->resourceProvider()->refQuadIndexBuffer()); |
- |
size_t vertexStride = this->geometryProcessor()->getVertexStride(); |
- const GrVertexBuffer* vertexBuffer; |
- int firstVertex; |
- |
- void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
- kVertsPerCubic, |
- &vertexBuffer, |
- &firstVertex); |
- |
- if (!vertices || !indexBuffer) { |
- SkDebugf("Could not allocate buffers\n"); |
+ SkASSERT(vertexStride == sizeof(SkPoint)); |
+ QuadHelper helper; |
+ SkPoint* verts = reinterpret_cast<SkPoint*>(helper.init(batchTarget, vertexStride, 1)); |
+ if (!verts) { |
return; |
} |
- SkASSERT(vertexStride == sizeof(SkPoint)); |
- SkPoint* verts = reinterpret_cast<SkPoint*>(vertices); |
- |
// Make sure any artifacts around the exterior of path are visible by using overly |
// conservative bounding geometry. |
fGeometry.fBounds.outset(5.f, 5.f); |
fGeometry.fBounds.toQuad(verts); |
- GrDrawTarget::DrawInfo drawInfo; |
- drawInfo.setPrimitiveType(kTriangleFan_GrPrimitiveType); |
- drawInfo.setVertexBuffer(vertexBuffer); |
- drawInfo.setStartVertex(firstVertex); |
- drawInfo.setVertexCount(kVertsPerCubic); |
- drawInfo.setStartIndex(0); |
- drawInfo.setIndexCount(kIndicesPerCubic); |
- drawInfo.setIndexBuffer(indexBuffer); |
- batchTarget->draw(drawInfo); |
+ helper.issueDraws(batchTarget); |
} |
Geometry fGeometry; |
- static const int kVertsPerCubic = 4; |
- static const int kIndicesPerCubic = 6; |
- |
typedef GrTestBatch INHERITED; |
}; |