Addition of necessary flush to copyToTexturePixelRef(...).

Ganesh batches drawing operations, which means that the copy operation, which does not flush the pipeline, can capture stale contents.  By forcing a flush, the up-to-date version of the texture is copied.

TEST=none
BUG=124054
Review URL: https://codereview.appspot.com/6129043

git-svn-id: http://skia.googlecode.com/svn/trunk@3785 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
twiz@google.com 2012-04-27 19:39:33 +00:00
parent 8c2cc1a4dd
commit 1ac87ff5aa

View File

@ -1915,6 +1915,12 @@ void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst) {
}
ASSERT_OWNED_RESOURCE(src);
// Writes pending to the source texture are not tracked, so a flush
// is required to ensure that the copy captures the most recent contents
// of the source texture. See similar behaviour in
// GrContext::resolveRenderTarget.
this->flush();
GrDrawTarget::AutoStateRestore asr(fGpu, GrDrawTarget::kReset_ASRInit);
GrDrawState* drawState = fGpu->drawState();
drawState->setRenderTarget(dst);