diff options
-rw-r--r-- | src/gpu/GrBatchTarget.cpp | 1 | ||||
-rw-r--r-- | src/gpu/GrBatchTarget.h | 8 | ||||
-rw-r--r-- | src/gpu/GrDefaultPathRenderer.cpp | 4 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/gpu/GrBatchTarget.cpp b/src/gpu/GrBatchTarget.cpp index 7a2d14e923..21658d2a01 100644 --- a/src/gpu/GrBatchTarget.cpp +++ b/src/gpu/GrBatchTarget.cpp @@ -7,7 +7,6 @@ #include "GrBatchTarget.h" -#include "GrBufferAllocPool.h" #include "GrPipeline.h" /* diff --git a/src/gpu/GrBatchTarget.h b/src/gpu/GrBatchTarget.h index 51dd8cac89..ae046c1ee1 100644 --- a/src/gpu/GrBatchTarget.h +++ b/src/gpu/GrBatchTarget.h @@ -8,6 +8,7 @@ #ifndef GrBatchBuffer_DEFINED #define GrBatchBuffer_DEFINED +#include "GrBufferAllocPool.h" #include "GrPendingProgramElement.h" #include "GrPipeline.h" #include "GrGpu.h" @@ -82,6 +83,13 @@ public: const GrIndexBuffer* quadIndexBuffer() const { return fGpu->getQuadIndexBuffer(); } + // A helper for draws which overallocate and then return data to the pool + void putBackIndices(size_t indices) { fIndexPool->putBack(indices * sizeof(uint16_t)); } + + void putBackVertices(size_t vertices, size_t vertexStride) { + fVertexPool->putBack(vertices * vertexStride); + } + private: GrGpu* fGpu; GrVertexBufferAllocPool* fVertexPool; diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp index 131b518296..302aad7795 100644 --- a/src/gpu/GrDefaultPathRenderer.cpp +++ b/src/gpu/GrDefaultPathRenderer.cpp @@ -372,6 +372,10 @@ public: drawInfo.setIndexCount(0); } batchTarget->draw(drawInfo); + + // put back reserves + batchTarget->putBackIndices((size_t)(maxIndices - indexOffset)); + batchTarget->putBackVertices((size_t)(maxVertices - vertexOffset), (size_t)vertexStride); } SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } |