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
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 835ab23..ac812cb 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1915,6 +1915,12 @@
}
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);