| Index: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
|
| diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
|
| index 6a8ec2ff8570d0b2178a1690f7f83a566583bae0..308395b3dde6b055058398594396b084d9739736 100644
|
| --- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
|
| +++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
|
| @@ -177,8 +177,9 @@ private:
|
| }
|
|
|
| struct FlushInfo {
|
| - SkAutoTUnref<const GrBuffer> fVertexBuffer;
|
| - SkAutoTUnref<const GrBuffer> fIndexBuffer;
|
| + SkAutoTUnref<const GrBuffer> fVertexBuffer;
|
| + SkAutoTUnref<const GrBuffer> fIndexBuffer;
|
| + SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor;
|
| int fVertexOffset;
|
| int fInstancesToFlush;
|
| };
|
| @@ -199,9 +200,11 @@ private:
|
|
|
| GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBilerp_FilterMode);
|
|
|
| + FlushInfo flushInfo;
|
| +
|
| // Setup GrGeometryProcessor
|
| GrBatchAtlas* atlas = fAtlas;
|
| - SkAutoTUnref<GrGeometryProcessor> dfProcessor(
|
| + flushInfo.fGeometryProcessor.reset(
|
| GrDistanceFieldPathGeoProc::Create(this->color(),
|
| this->viewMatrix(),
|
| atlas->getTexture(),
|
| @@ -209,12 +212,8 @@ private:
|
| flags,
|
| this->usesLocalCoords()));
|
|
|
| - target->initDraw(dfProcessor);
|
| -
|
| - FlushInfo flushInfo;
|
| -
|
| // allocate vertices
|
| - size_t vertexStride = dfProcessor->getVertexStride();
|
| + size_t vertexStride = flushInfo.fGeometryProcessor->getVertexStride();
|
| SkASSERT(vertexStride == 2 * sizeof(SkPoint) + sizeof(GrColor));
|
|
|
| const GrBuffer* vertexBuffer;
|
| @@ -260,8 +259,6 @@ private:
|
| SkScalar scale = desiredDimension/maxDim;
|
| pathData = new PathData;
|
| if (!this->addPathToAtlas(target,
|
| - dfProcessor,
|
| - this->pipeline(),
|
| &flushInfo,
|
| atlas,
|
| pathData,
|
| @@ -276,15 +273,13 @@ private:
|
| }
|
| }
|
|
|
| - atlas->setLastUseToken(pathData->fID, target->currentToken());
|
| + atlas->setLastUseToken(pathData->fID, target->nextDrawToken());
|
|
|
| // Now set vertices
|
| intptr_t offset = reinterpret_cast<intptr_t>(vertices);
|
| offset += i * kVerticesPerQuad * vertexStride;
|
| this->writePathVertices(target,
|
| atlas,
|
| - this->pipeline(),
|
| - dfProcessor,
|
| offset,
|
| args.fColor,
|
| vertexStride,
|
| @@ -317,8 +312,6 @@ private:
|
| }
|
|
|
| bool addPathToAtlas(GrVertexBatch::Target* target,
|
| - const GrGeometryProcessor* dfProcessor,
|
| - const GrPipeline* pipeline,
|
| FlushInfo* flushInfo,
|
| GrBatchAtlas* atlas,
|
| PathData* pathData,
|
| @@ -407,7 +400,6 @@ private:
|
| &atlasLocation);
|
| if (!success) {
|
| this->flush(target, flushInfo);
|
| - target->initDraw(dfProcessor);
|
|
|
| SkDEBUGCODE(success =) atlas->addToAtlas(&id, target, width, height,
|
| dfStorage.get(), &atlasLocation);
|
| @@ -444,8 +436,6 @@ private:
|
|
|
| void writePathVertices(GrDrawBatch::Target* target,
|
| GrBatchAtlas* atlas,
|
| - const GrPipeline* pipeline,
|
| - const GrGeometryProcessor* gp,
|
| intptr_t offset,
|
| GrColor color,
|
| size_t vertexStride,
|
| @@ -497,7 +487,7 @@ private:
|
| mesh.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuffer,
|
| flushInfo->fIndexBuffer, flushInfo->fVertexOffset, kVerticesPerQuad,
|
| kIndicesPerQuad, flushInfo->fInstancesToFlush, maxInstancesPerDraw);
|
| - target->draw(mesh);
|
| + target->draw(flushInfo->fGeometryProcessor, mesh);
|
| flushInfo->fVertexOffset += kVerticesPerQuad * flushInfo->fInstancesToFlush;
|
| flushInfo->fInstancesToFlush = 0;
|
| }
|
|
|