diff options
author | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-05 19:22:27 +0000 |
---|---|---|
committer | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-05 19:22:27 +0000 |
commit | 9349101b6cee7c4cfb570925a727c0bf7b0c676e (patch) | |
tree | fe60941df0ab676b6c4f4dfd7d8b31486d989a51 /tests | |
parent | 493c65f1aa0864857c21b2be096740a17ef1430a (diff) |
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
Diffstat (limited to 'tests')
-rw-r--r-- | tests/GpuBitmapCopyTest.cpp | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/tests/GpuBitmapCopyTest.cpp b/tests/GpuBitmapCopyTest.cpp index 74299da4e6..cf9139c952 100644 --- a/tests/GpuBitmapCopyTest.cpp +++ b/tests/GpuBitmapCopyTest.cpp @@ -33,19 +33,6 @@ struct Pair { 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 @@ static void TestSubsetHelpers(skiatest::Reporter* reporter, const SkBitmap& bitm * @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 @@ static void TestIndividualCopy(skiatest::Reporter* reporter, const SkBitmap::Con 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 @@ static void TestIndividualCopy(skiatest::Reporter* reporter, const SkBitmap::Con } 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 @@ static void TestGpuBitmapCopy(skiatest::Reporter* reporter, GrContextFactory* fa // 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 @@ static void TestGpuBitmapCopy(skiatest::Reporter* reporter, GrContextFactory* fa 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 = ... |