Add support for GL_ANGLE_pack_reverse_row_order

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


git-svn-id: http://skia.googlecode.com/svn/trunk@2774 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 57f9a31..70c9f6d 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1761,7 +1761,20 @@
             { config }
         };
 
-        ast.set(this, desc);
+        // When a full readback is faster than a partial we could always make
+        // the scratch exactly match the passed rect. However, if we see many
+        // different size rectangles we will trash our texture cache and pay the
+        // cost of creating and destroying many textures. So, we only request
+        // an exact match when the caller is reading an entire RT.
+        ScratchTexMatch match = kApprox_ScratchTexMatch;
+        if (0 == left &&
+            0 == top &&
+            target->width() == width &&
+            target->height() == height &&
+            fGpu->fullReadPixelsIsFasterThanPartial()) {
+            match = kExact_ScratchTexMatch;
+        }
+        ast.set(this, desc, match);
         GrTexture* texture = ast.texture();
         if (!texture) {
             return false;