diff options
author | 2016-07-21 09:35:07 -0700 | |
---|---|---|
committer | 2016-07-21 09:35:07 -0700 | |
commit | f292a0c862f1c120cade1e8ac0f1882844eb343a (patch) | |
tree | b4e7f152669539c0db638b6606e3ff79013a7b48 /tests | |
parent | 725266a9b174b987911e47537d0353c607aefb2f (diff) |
Remove SkGrPixelRef
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2167173002
Review-Url: https://codereview.chromium.org/2167173002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/BitmapCopyTest.cpp | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp index 848a83e45a..639c51a5f1 100644 --- a/tests/BitmapCopyTest.cpp +++ b/tests/BitmapCopyTest.cpp @@ -633,88 +633,3 @@ DEF_TEST(BitmapReadPixels, reporter) { } } -#if SK_SUPPORT_GPU - -#include "GrContext.h" -#include "SkGr.h" -#include "SkColorPriv.h" -/** Tests calling copyTo on a texture backed bitmap. Tests that all BGRA_8888/RGBA_8888 combinations - of src and dst work. This test should be removed when SkGrPixelRef is removed. */ -DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BitmapCopy_Texture, reporter, ctxInfo) { - static const SkPMColor kData[] = { - 0xFF112233, 0xAF224499, - 0xEF004466, 0x80773311 - }; - - uint32_t swizData[SK_ARRAY_COUNT(kData)]; - for (size_t i = 0; i < SK_ARRAY_COUNT(kData); ++i) { - swizData[i] = SkSwizzle_RB(kData[i]); - } - - static const GrPixelConfig kSrcConfigs[] = { - kRGBA_8888_GrPixelConfig, - kBGRA_8888_GrPixelConfig, - }; - - for (size_t srcC = 0; srcC < SK_ARRAY_COUNT(kSrcConfigs); ++srcC) { - for (int rt = 0; rt < 2; ++rt) { - GrSurfaceDesc desc; - desc.fConfig = kSrcConfigs[srcC]; - desc.fFlags = rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags; - desc.fWidth = 2; - desc.fHeight = 2; - desc.fOrigin = kTopLeft_GrSurfaceOrigin; - - const void* srcData = (kSkia8888_GrPixelConfig == desc.fConfig) ? kData : swizData; - - SkAutoTUnref<GrTexture> texture( - ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo, - srcData, 0)); - - if (!texture) { - continue; - } - - SkBitmap srcBmp; - GrWrapTextureInBitmap(texture, 2, 2, false, &srcBmp); - if (srcBmp.isNull()) { - ERRORF(reporter, "Could not wrap texture in bitmap."); - continue; - } - static const SkColorType kDstCTs[] = { kRGBA_8888_SkColorType, kBGRA_8888_SkColorType }; - for (size_t dCT = 0; dCT < SK_ARRAY_COUNT(kDstCTs); ++dCT) { - SkBitmap dstBmp; - if (!srcBmp.copyTo(&dstBmp, kDstCTs[dCT])) { - ERRORF(reporter, "CopyTo failed."); - } - if (dstBmp.colorType() != kDstCTs[dCT]) { - ERRORF(reporter, "SkBitmap::CopyTo did not respect passed in color type."); - } - SkAutoLockPixels alp(dstBmp); - uint8_t* dstBmpPixels = static_cast<uint8_t*>(dstBmp.getPixels()); - const uint32_t* refData; -#if defined(SK_PMCOLOR_IS_RGBA) - refData = (kRGBA_8888_SkColorType == dstBmp.colorType()) ? kData : swizData; -#elif defined(SK_PMCOLOR_IS_BGRA) - refData = (kBGRA_8888_SkColorType == dstBmp.colorType()) ? kData : swizData; -#else - #error "PM Color must be BGRA or RGBA to use GPU backend." -#endif - bool foundError = false; - for (int y = 0; y < 2 && !foundError; ++y) { - uint32_t* dstBmpRow = reinterpret_cast<uint32_t*>(dstBmpPixels); - for (int x = 0; x < 2 && !foundError; ++x) { - if (refData[2 * y + x] != dstBmpRow[x]) { - ERRORF(reporter, "Expected pixel 0x%08x, found 0x%08x.", - refData[2 * y + x], dstBmpRow[x]); - foundError = true; - } - } - dstBmpPixels += dstBmp.rowBytes(); - } - } - } - } -} - -#endif |