Hold onto scratch texture until end of readRenderTargetPixels

Review URL: http://codereview.appspot.com/5369065/



git-svn-id: http://skia.googlecode.com/svn/trunk@2664 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index da26bc6..12b8b07 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1707,8 +1707,8 @@
         // also a texture (e.g. FBO 0 in GL)
         return false;
     }
-
     // we draw to a scratch texture if any of these conversion are applied
+    GrAutoScratchTexture ast;
     if (flipY || swapRAndB || alphaConversion) {
         GrAssert(NULL != src);
         if (swapRAndB) {
@@ -1723,7 +1723,8 @@
             width, height,
             { config }
         };
-        GrAutoScratchTexture ast(this, desc);
+
+        ast.set(this, desc);
         GrTexture* texture = ast.texture();
         if (!texture) {
             return false;