From 7539856c1b9cbb1886a6a498cc534b77fc83ddb2 Mon Sep 17 00:00:00 2001 From: bsalomon Date: Mon, 17 Aug 2015 12:55:38 -0700 Subject: Make GrVertexBatch objects hold their own draws during GrDrawTarget flush NO_MERGE_BUILDS Review URL: https://codereview.chromium.org/1286043004 --- src/gpu/batches/GrDrawAtlasBatch.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/gpu/batches/GrDrawAtlasBatch.cpp') diff --git a/src/gpu/batches/GrDrawAtlasBatch.cpp b/src/gpu/batches/GrDrawAtlasBatch.cpp index 487580c39d..3596e16861 100644 --- a/src/gpu/batches/GrDrawAtlasBatch.cpp +++ b/src/gpu/batches/GrDrawAtlasBatch.cpp @@ -6,6 +6,7 @@ */ #include "GrDrawAtlasBatch.h" +#include "GrBatchFlushState.h" #include "GrBatchTest.h" #include "SkGr.h" #include "SkRandom.h" @@ -41,14 +42,14 @@ static const GrGeometryProcessor* set_vertex_attributes(bool hasColors, return GrDefaultGeoProcFactory::Create(gpColor, coverage, localCoords, viewMatrix); } -void GrDrawAtlasBatch::generateGeometry(GrBatchTarget* batchTarget) { +void GrDrawAtlasBatch::onPrepareDraws(Target* target) { // Setup geometry processor SkAutoTUnref gp(set_vertex_attributes(this->hasColors(), this->color(), this->viewMatrix(), this->coverageIgnored())); - batchTarget->initDraw(gp, this->pipeline()); + target->initDraw(gp, this->pipeline()); int instanceCount = fGeoData.count(); size_t vertexStride = gp->getVertexStride(); @@ -57,7 +58,7 @@ void GrDrawAtlasBatch::generateGeometry(GrBatchTarget* batchTarget) { QuadHelper helper; int numQuads = this->quadCount(); - void* verts = helper.init(batchTarget, vertexStride, numQuads); + void* verts = helper.init(target, vertexStride, numQuads); if (!verts) { SkDebugf("Could not allocate vertices\n"); return; @@ -71,7 +72,7 @@ void GrDrawAtlasBatch::generateGeometry(GrBatchTarget* batchTarget) { memcpy(vertPtr, args.fVerts.begin(), allocSize); vertPtr += allocSize; } - helper.issueDraw(batchTarget); + helper.recordDraw(target); } GrDrawAtlasBatch::GrDrawAtlasBatch(const Geometry& geometry, const SkMatrix& viewMatrix, -- cgit v1.2.3