diff options
author | Mike Reed <reed@google.com> | 2017-07-12 15:10:28 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-12 20:25:44 +0000 |
commit | 304a07c6c93298c3481bc0d4852d08c22a539504 (patch) | |
tree | ac9b11aab296f645ea66e02cc9e91abad10cd6eb /tests | |
parent | 7da6ba2d63cfd5ae6add617f18ba4882e755642b (diff) |
remove references to kIndex_8_SkColorType from our tools/tests
Bug: skia:6828
Change-Id: Ib5049c28c11b7320bece20f5a0a886de8b2a4343
Reviewed-on: https://skia-review.googlesource.com/22728
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/BitmapCopyTest.cpp | 20 | ||||
-rw-r--r-- | tests/ReadPixelsTest.cpp | 25 |
2 files changed, 7 insertions, 38 deletions
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp index dd5bf1afde..d5da4be0da 100644 --- a/tests/BitmapCopyTest.cpp +++ b/tests/BitmapCopyTest.cpp @@ -21,13 +21,6 @@ static void init_src(const SkBitmap& bitmap) { } } -static sk_sp<SkColorTable> init_ctable() { - static const SkColor colors[] = { - SK_ColorBLACK, SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE - }; - return SkColorTable::Make(colors, SK_ARRAY_COUNT(colors)); -} - struct Pair { SkColorType fColorType; const char* fValid; @@ -63,7 +56,6 @@ struct Coordinates { static const Pair gPairs[] = { { kUnknown_SkColorType, "0000000" }, { kAlpha_8_SkColorType, "0100000" }, - { kIndex_8_SkColorType, "0101111" }, { kRGB_565_SkColorType, "0101011" }, { kARGB_4444_SkColorType, "0101111" }, { kN32_SkColorType, "0101111" }, @@ -75,18 +67,13 @@ static const int H = 33; static void setup_src_bitmaps(SkBitmap* srcOpaque, SkBitmap* srcPremul, SkColorType ct) { - sk_sp<SkColorTable> ctable; - if (kIndex_8_SkColorType == ct) { - ctable = init_ctable(); - } - sk_sp<SkColorSpace> colorSpace = nullptr; if (kRGBA_F16_SkColorType == ct) { colorSpace = SkColorSpace::MakeSRGBLinear(); } - srcOpaque->allocPixels(SkImageInfo::Make(W, H, ct, kOpaque_SkAlphaType, colorSpace), ctable); - srcPremul->allocPixels(SkImageInfo::Make(W, H, ct, kPremul_SkAlphaType, colorSpace), ctable); + srcOpaque->allocPixels(SkImageInfo::Make(W, H, ct, kOpaque_SkAlphaType, colorSpace)); + srcPremul->allocPixels(SkImageInfo::Make(W, H, ct, kPremul_SkAlphaType, colorSpace)); init_src(*srcOpaque); init_src(*srcPremul); } @@ -117,8 +104,7 @@ DEF_TEST(BitmapCopy_extractSubset, reporter) { if (!success) { // Skip checking that success matches fValid, which is redundant // with the code below. - REPORTER_ASSERT(reporter, kIndex_8_SkColorType == gPairs[i].fColorType || - gPairs[i].fColorType != gPairs[j].fColorType); + REPORTER_ASSERT(reporter, gPairs[i].fColorType != gPairs[j].fColorType); continue; } diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp index a30576f74c..f426e5ffff 100644 --- a/tests/ReadPixelsTest.cpp +++ b/tests/ReadPixelsTest.cpp @@ -503,16 +503,6 @@ static const uint64_t f16[kNumPixels] = { kAlpha | kRed, kAlpha | kGreen, kAlpha | kBlue, kAlpha | kBlue | kGreen | kRed, kAlpha }; -#ifdef SK_PMCOLOR_IS_RGBA -static const SkPMColor index8colors[kNumPixels] = { - 0xFF0000FF, 0xFF00FF00, 0xFFFF0000, 0xFFFFFFFF, 0xFF000000 -}; -#else -static const SkPMColor index8colors[kNumPixels] = { - 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFFFFFFFF, 0xFF000000 -}; -#endif -static const uint8_t index8[kNumPixels] = { 0, 1, 2, 3, 4 }; static const uint8_t alpha8[kNumPixels] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; static const uint8_t gray8[kNumPixels] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; @@ -530,12 +520,12 @@ static const void* five_reference_pixels(SkColorType colorType) { return rgba; case kBGRA_8888_SkColorType: return bgra; - case kIndex_8_SkColorType: - return index8; case kGray_8_SkColorType: return gray8; case kRGBA_F16_SkColorType: return f16; + default: + return nullptr; // remove me when kIndex_8 is removed from the enum } SkASSERT(false); @@ -548,21 +538,14 @@ static void test_conversion(skiatest::Reporter* r, const SkImageInfo& dstInfo, return; } - sk_sp<SkColorTable> srcColorTable = (kIndex_8_SkColorType == srcInfo.colorType()) - ? sk_make_sp<SkColorTable>(index8colors, 5) - : nullptr; - sk_sp<SkColorTable> dstColorTable = (kIndex_8_SkColorType == dstInfo.colorType()) - ? sk_make_sp<SkColorTable>(index8colors, 5) - : nullptr; - const void* srcPixels = five_reference_pixels(srcInfo.colorType()); - SkPixmap srcPixmap(srcInfo, srcPixels, srcInfo.minRowBytes(), srcColorTable.get()); + SkPixmap srcPixmap(srcInfo, srcPixels, srcInfo.minRowBytes()); sk_sp<SkImage> src = SkImage::MakeFromRaster(srcPixmap, nullptr, nullptr); REPORTER_ASSERT(r, src); // Enough space for 5 pixels when color type is F16, more than enough space in other cases. uint64_t dstPixels[kNumPixels]; - SkPixmap dstPixmap(dstInfo, dstPixels, dstInfo.minRowBytes(), dstColorTable.get()); + SkPixmap dstPixmap(dstInfo, dstPixels, dstInfo.minRowBytes()); bool success = src->readPixels(dstPixmap, 0, 0); REPORTER_ASSERT(r, success == SkImageInfoValidConversion(dstInfo, srcInfo)); |