From 9528bdb0dccee915505bcf99cb10659f85e2604b Mon Sep 17 00:00:00 2001 From: "robertphillips@google.com" Date: Wed, 18 Sep 2013 22:33:57 +0000 Subject: [PATCH] Don't reuse scratch textures update https://codereview.chromium.org/23609026/ git-svn-id: http://skia.googlecode.com/svn/trunk@11366 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/gpu/GrInOrderDrawBuffer.cpp | 5 ++--- src/gpu/GrSWMaskHelper.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp index 1cd04d9e1b..8c8fbfc4ce 100644 --- a/src/gpu/GrInOrderDrawBuffer.cpp +++ b/src/gpu/GrInOrderDrawBuffer.cpp @@ -567,9 +567,8 @@ void GrInOrderDrawBuffer::initCopySurfaceDstDesc(const GrSurface* src, GrTexture fDstGpu->initCopySurfaceDstDesc(src, desc); } -void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace( - int vertexCount, - int indexCount) { +void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount, + int indexCount) { // We use geometryHints() to know whether to flush the draw buffer. We // can't flush if we are inside an unbalanced pushGeometrySource. // Moreover, flushing blows away vertex and index data that was diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index f6e6c3127d..6b2a75990e 100644 --- a/src/gpu/GrSWMaskHelper.cpp +++ b/src/gpu/GrSWMaskHelper.cpp @@ -7,6 +7,7 @@ #include "GrSWMaskHelper.h" #include "GrDrawState.h" +#include "GrDrawTargetCaps.h" #include "GrGpu.h" #include "SkStrokeRec.h" @@ -133,9 +134,14 @@ bool GrSWMaskHelper::getTexture(GrAutoScratchTexture* texture) { void GrSWMaskHelper::toTexture(GrTexture *texture) { SkAutoLockPixels alp(fBM); + // If we aren't reusing scratch textures we don't need to flush before + // writing since no one else will be using 'texture' + bool reuseScratch = fContext->getGpu()->caps()->reuseScratchTextures(); + texture->writePixels(0, 0, fBM.width(), fBM.height(), kAlpha_8_GrPixelConfig, - fBM.getPixels(), fBM.rowBytes()); + fBM.getPixels(), fBM.rowBytes(), + reuseScratch ? 0 : GrContext::kDontFlush_PixelOpsFlag); } ////////////////////////////////////////////////////////////////////////////////