Index: src/gpu/effects/GrDashingEffect.cpp |
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp |
index 3f0df6737796a42a0ccbba098e23855843908d50..fa8b3a2dcf941bfc6c29b2fa27e39f6bcb1c49f8 100644 |
--- a/src/gpu/effects/GrDashingEffect.cpp |
+++ b/src/gpu/effects/GrDashingEffect.cpp |
@@ -19,6 +19,7 @@ |
#include "GrDrawTargetCaps.h" |
#include "GrInvariantOutput.h" |
#include "GrProcessor.h" |
+#include "GrResourceProvider.h" |
#include "GrStrokeInfo.h" |
#include "GrVertexBuffer.h" |
#include "SkGr.h" |
@@ -535,16 +536,17 @@ public: |
draw.fHasEndRect = hasEndRect; |
} |
+ SkAutoTUnref<const GrIndexBuffer> indexBuffer( |
+ batchTarget->resourceProvider()->refQuadIndexBuffer()); |
+ |
const GrVertexBuffer* vertexBuffer; |
int firstVertex; |
- |
size_t vertexStride = gp->getVertexStride(); |
void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
totalRectCount * kVertsPerDash, |
&vertexBuffer, |
&firstVertex); |
- |
- if (!vertices || !batchTarget->quadIndexBuffer()) { |
+ if (!vertices || !indexBuffer) { |
SkDebugf("Could not allocate buffers\n"); |
return; |
} |
@@ -607,8 +609,6 @@ public: |
rectIndex++; |
} |
- const GrIndexBuffer* dashIndexBuffer = batchTarget->quadIndexBuffer(); |
- |
GrDrawTarget::DrawInfo drawInfo; |
drawInfo.setPrimitiveType(kTriangles_GrPrimitiveType); |
drawInfo.setStartVertex(0); |
@@ -617,9 +617,9 @@ public: |
drawInfo.setIndicesPerInstance(kIndicesPerDash); |
drawInfo.adjustStartVertex(firstVertex); |
drawInfo.setVertexBuffer(vertexBuffer); |
- drawInfo.setIndexBuffer(dashIndexBuffer); |
+ drawInfo.setIndexBuffer(indexBuffer); |
- int maxInstancesPerDraw = dashIndexBuffer->maxQuads(); |
+ int maxInstancesPerDraw = indexBuffer->maxQuads(); |
while (totalRectCount) { |
drawInfo.setInstanceCount(SkTMin(totalRectCount, maxInstancesPerDraw)); |
drawInfo.setVertexCount(drawInfo.instanceCount() * drawInfo.verticesPerInstance()); |
@@ -761,7 +761,7 @@ static GrBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const Sk |
return DashBatch::Create(geometry, cap, aaMode, fullDash); |
} |
-bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target, |
+bool GrDashingEffect::DrawDashLine(GrDrawTarget* target, |
GrPipelineBuilder* pipelineBuilder, GrColor color, |
const SkMatrix& viewMatrix, const SkPoint pts[2], |
bool useAA, const GrStrokeInfo& strokeInfo) { |