Implement support for origin-TopLeft render targets in GL backend.

Committed: https://code.google.com/p/skia/source/detail?r=7545

Reverted in r7571; re-opening.

Review URL: https://codereview.appspot.com/7230049

git-svn-id: http://skia.googlecode.com/svn/trunk@7592 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/GpuBitmapCopyTest.cpp b/tests/GpuBitmapCopyTest.cpp
index 74299da..cf9139c 100644
--- a/tests/GpuBitmapCopyTest.cpp
+++ b/tests/GpuBitmapCopyTest.cpp
@@ -33,19 +33,6 @@
     const char*         fValid;
 };
 
-extern bool getUpperLeftFromOffset(const SkBitmap& bm, int* x, int* y);
-extern size_t getSubOffset(const SkBitmap& bm, int x, int y);
-
-/**
- *  Tests that getUpperLeftFromOffset and getSubOffset agree with each other.
- */
-static void TestSubsetHelpers(skiatest::Reporter* reporter, const SkBitmap& bitmap){
-    int x, y;
-    bool upperLeft = getUpperLeftFromOffset(bitmap, &x, &y);
-    REPORTER_ASSERT(reporter, upperLeft);
-    REPORTER_ASSERT(reporter, getSubOffset(bitmap, x, y) == bitmap.pixelRefOffset());
-}
-
 /**
  *  Check to ensure that copying a GPU-backed SkBitmap behaved as expected.
  *  @param reporter Used to report failures.
@@ -54,12 +41,10 @@
  *  @param src A GPU-backed SkBitmap that had copyTo or deepCopyTo called on it.
  *  @param dst SkBitmap that was copied to.
  *  @param deepCopy True if deepCopyTo was used; false if copyTo was used.
- *  @param subset Portion of src's SkPixelRef that src represents. dst should represent the same
- *      portion after the copy. Pass NULL for all pixels.
  */
 static void TestIndividualCopy(skiatest::Reporter* reporter, const SkBitmap::Config desiredConfig,
                                const bool success, const SkBitmap& src, const SkBitmap& dst,
-                               const bool deepCopy = true, const SkIRect* subset = NULL) {
+                               const bool deepCopy = true) {
     if (success) {
         REPORTER_ASSERT(reporter, src.width() == dst.width());
         REPORTER_ASSERT(reporter, src.height() == dst.height());
@@ -78,11 +63,11 @@
             SkBitmap srcReadBack, dstReadBack;
             {
                 SkASSERT(src.getTexture() != NULL);
-                bool readBack = src.pixelRef()->readPixels(&srcReadBack, subset);
+                bool readBack = src.pixelRef()->readPixels(&srcReadBack);
                 REPORTER_ASSERT(reporter, readBack);
             }
             if (dst.getTexture() != NULL) {
-                bool readBack = dst.pixelRef()->readPixels(&dstReadBack, subset);
+                bool readBack = dst.pixelRef()->readPixels(&dstReadBack);
                 REPORTER_ASSERT(reporter, readBack);
             } else {
                 // If dst is not a texture, do a copy instead, to the same config as srcReadBack.
@@ -102,11 +87,6 @@
         } else {
             REPORTER_ASSERT(reporter, src.getGenerationID() != dst.getGenerationID());
         }
-
-        // If the copy used a subset, test the pixel offset calculation functions.
-        if (subset != NULL) {
-            TestSubsetHelpers(reporter, dst);
-        }
     } else {
         // dst should be unchanged from its initial state
         REPORTER_ASSERT(reporter, dst.config() == SkBitmap::kNo_Config);
@@ -170,9 +150,6 @@
             // Extract a subset. If this succeeds we will test copying the subset.
             SkBitmap subset;
             const bool extracted = src.extractSubset(&subset, subsetRect);
-            if (extracted) {
-                TestSubsetHelpers(reporter, subset);
-            }
 
             for (size_t j = 0; j < SK_ARRAY_COUNT(gPairs); j++) {
                 dst.reset();
@@ -204,16 +181,16 @@
                     success = subset.copyTo(&subsetCopy, gPairs[j].fConfig);
                     REPORTER_ASSERT(reporter, success == expected);
                     REPORTER_ASSERT(reporter, success == canSucceed);
-                    TestIndividualCopy(reporter, gPairs[j].fConfig, success, subset, subsetCopy, false,
-                                       &subsetRect);
+                    TestIndividualCopy(reporter, gPairs[j].fConfig, success, subset, subsetCopy,
+                                       false);
 
                     // Reset the bitmap so that a failed copyTo will leave it in the expected state.
                     subsetCopy.reset();
                     success = subset.deepCopyTo(&subsetCopy, gPairs[j].fConfig);
                     REPORTER_ASSERT(reporter, success == expected);
                     REPORTER_ASSERT(reporter, success == canSucceed);
-                    TestIndividualCopy(reporter, gPairs[j].fConfig, success, subset, subsetCopy, true,
-                                       &subsetRect);
+                    TestIndividualCopy(reporter, gPairs[j].fConfig, success, subset, subsetCopy,
+                                       true);
                 }
             } // for (size_t j = ...
         } // for (size_t i = ...