Index: src/gpu/GrAADistanceFieldPathRenderer.cpp |
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp |
index ca8c52fa348289ad62ad95f0d530c46857f55db0..669ec09d97ae02ab629204199a5f22fc38500390 100755 |
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp |
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp |
@@ -15,7 +15,6 @@ |
#include "GrPipelineBuilder.h" |
#include "GrSurfacePriv.h" |
#include "GrSWMaskHelper.h" |
-#include "GrResourceProvider.h" |
#include "GrTexturePriv.h" |
#include "GrVertexBuffer.h" |
#include "effects/GrDistanceFieldGeoProc.h" |
@@ -195,17 +194,13 @@ |
this->initDraw(batchTarget, dfProcessor, pipeline); |
- static const int kVertsPerQuad = 4; |
- static const int kIndicesPerQuad = 6; |
- |
- SkAutoTUnref<const GrIndexBuffer> indexBuffer( |
- batchTarget->resourceProvider()->refQuadIndexBuffer()); |
- |
// allocate vertices |
size_t vertexStride = dfProcessor->getVertexStride(); |
SkASSERT(vertexStride == 2 * sizeof(SkPoint)); |
+ |
+ int vertexCount = GrBatchTarget::kVertsPerRect * instanceCount; |
+ |
const GrVertexBuffer* vertexBuffer; |
- int vertexCount = kVertsPerQuad * instanceCount; |
int firstVertex; |
void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
@@ -213,23 +208,24 @@ |
&vertexBuffer, |
&firstVertex); |
- if (!vertices || !indexBuffer) { |
+ if (!vertices) { |
SkDebugf("Could not allocate vertices\n"); |
return; |
} |
// We may have to flush while uploading path data to the atlas, so we set up the draw here |
- int maxInstancesPerDraw = indexBuffer->maxQuads(); |
+ const GrIndexBuffer* quadIndexBuffer = batchTarget->quadIndexBuffer(); |
+ int maxInstancesPerDraw = quadIndexBuffer->maxQuads(); |
GrDrawTarget::DrawInfo drawInfo; |
drawInfo.setPrimitiveType(kTriangles_GrPrimitiveType); |
drawInfo.setStartVertex(0); |
drawInfo.setStartIndex(0); |
- drawInfo.setVerticesPerInstance(kVertsPerQuad); |
- drawInfo.setIndicesPerInstance(kIndicesPerQuad); |
+ drawInfo.setVerticesPerInstance(GrBatchTarget::kVertsPerRect); |
+ drawInfo.setIndicesPerInstance(GrBatchTarget::kIndicesPerRect); |
drawInfo.adjustStartVertex(firstVertex); |
drawInfo.setVertexBuffer(vertexBuffer); |
- drawInfo.setIndexBuffer(indexBuffer); |
+ drawInfo.setIndexBuffer(quadIndexBuffer); |
int instancesToFlush = 0; |
for (int i = 0; i < instanceCount; i++) { |
@@ -284,7 +280,7 @@ |
// Now set vertices |
intptr_t offset = reinterpret_cast<intptr_t>(vertices); |
- offset += i * kVertsPerQuad * vertexStride; |
+ offset += i * GrBatchTarget::kVertsPerRect * vertexStride; |
SkPoint* positions = reinterpret_cast<SkPoint*>(offset); |
this->drawPath(batchTarget, |
atlas, |