flip Y in uploads to bottom-up textures (and add gm test)

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



git-svn-id: http://skia.googlecode.com/svn/trunk@1882 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 1587a9a..373356e 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -482,6 +482,13 @@
 #endif
 };
 
+namespace skiagm {
+static GrContext* gGrContext;
+GrContext* GetGr() {
+    return gGrContext;
+}
+}
+
 int main(int argc, char * const argv[]) {
     SkAutoGraphics ag;
 
@@ -533,10 +540,9 @@
         maxH = SkMax32(size.height(), maxH);
     }
     // setup a GL context for drawing offscreen
-    GrContext* context = NULL;
     SkEGLContext eglContext;
     if (eglContext.init(maxW, maxH)) {
-        context = GrContext::CreateGLShaderContext();
+        gGrContext = GrContext::CreateGLShaderContext();
     }
 
 
@@ -558,7 +564,7 @@
 
         for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) {
             bool testSuccess = test_drawing(gm, gRec[i],
-                         writePath, readPath, diffPath, context,
+                         writePath, readPath, diffPath, gGrContext,
                          &forwardRenderedBitmap);
             overallSuccess &= testSuccess;