From a0b266d8170211d9f2a6f90ba9c889f0c1b6d1b6 Mon Sep 17 00:00:00 2001 From: "scroggo@google.com" Date: Wed, 4 Dec 2013 19:56:31 +0000 Subject: [PATCH] Remove deprecated setPrefConfigTable. Safe once its only caller (in Android) has been updated. BUG=skia:1874 R=reed@google.com Review URL: https://codereview.chromium.org/99473004 git-svn-id: http://skia.googlecode.com/svn/trunk@12491 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkImageDecoder.h | 30 ------------------------------ src/images/SkImageDecoder.cpp | 13 ------------- tests/ImageDecodingTest.cpp | 35 ----------------------------------- 3 files changed, 78 deletions(-) diff --git a/include/core/SkImageDecoder.h b/include/core/SkImageDecoder.h index a7e3646553..b255e2ad25 100644 --- a/include/core/SkImageDecoder.h +++ b/include/core/SkImageDecoder.h @@ -158,36 +158,6 @@ public: Chooser* getChooser() const { return fChooser; } Chooser* setChooser(Chooser*); - /** - @Deprecated. Use the struct version instead. - - This optional table describes the caller's preferred config based on - information about the src data. For this table, the src attributes are - described in terms of depth (index (8), 16, 32/24) and if there is - per-pixel alpha. These inputs combine to create an index into the - pref[] table, which contains the caller's preferred config for that - input, or kNo_Config if there is no preference. - - To specify no preference, call setPrefConfigTable(NULL), which is - the default. - - Note, it is still at the discretion of the codec as to what output - config is actually returned, as it may not be able to support the - caller's preference. - - Here is how the index into the table is computed from the src: - depth [8, 16, 32/24] -> 0, 2, 4 - alpha [no, yes] -> 0, 1 - The two index values are OR'd together. - src: 8-index, no-alpha -> 0 - src: 8-index, yes-alpha -> 1 - src: 16bit, no-alpha -> 2 // e.g. 565 - src: 16bit, yes-alpha -> 3 // e.g. 1555 - src: 32/24, no-alpha -> 4 - src: 32/24, yes-alpha -> 5 - */ - void setPrefConfigTable(const SkBitmap::Config pref[6]); - /** * Optional table describing the caller's preferred config based on * information about the src data. Each field should be set to the diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp index 1ba9365255..6bfd4f1a60 100644 --- a/src/images/SkImageDecoder.cpp +++ b/src/images/SkImageDecoder.cpp @@ -143,19 +143,6 @@ bool SkImageDecoder::allocPixelRef(SkBitmap* bitmap, /////////////////////////////////////////////////////////////////////////////// -void SkImageDecoder::setPrefConfigTable(const SkBitmap::Config pref[6]) { - if (NULL == pref) { - fUsePrefTable = false; - } else { - fUsePrefTable = true; - fPrefTable.fPrefFor_8Index_NoAlpha_src = pref[0]; - fPrefTable.fPrefFor_8Index_YesAlpha_src = pref[1]; - fPrefTable.fPrefFor_8Gray_src = SkBitmap::kNo_Config; - fPrefTable.fPrefFor_8bpc_NoAlpha_src = pref[4]; - fPrefTable.fPrefFor_8bpc_YesAlpha_src = pref[5]; - } -} - void SkImageDecoder::setPrefConfigTable(const PrefConfigTable& prefTable) { fUsePrefTable = true; fPrefTable = prefTable; diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp index 6fcef1d315..be8626f0f6 100644 --- a/tests/ImageDecodingTest.cpp +++ b/tests/ImageDecodingTest.cpp @@ -139,40 +139,6 @@ static void compare_unpremul(skiatest::Reporter* reporter, const SkString& filen } } -// Create a fake ImageDecoder to test setPrefConfigTable for -// backwards compatibility. -class PrefConfigTestingImageDecoder : public SkImageDecoder { -public: - void testPrefConfigTable(skiatest::Reporter* reporter) { - // Arbitrary list of Configs. The important thing about - // the list is that each one is different, so we can test - // to make sure the correct config is chosen. - const SkBitmap::Config configs[] = { - SkBitmap::kA8_Config, - SkBitmap::kA8_Config, - SkBitmap::kIndex8_Config, - SkBitmap::kRGB_565_Config, - SkBitmap::kARGB_4444_Config, - SkBitmap::kARGB_8888_Config, - }; - this->setPrefConfigTable(configs); - REPORTER_ASSERT(reporter, configs[0] == this->getPrefConfig(kIndex_SrcDepth, false)); - REPORTER_ASSERT(reporter, configs[1] == this->getPrefConfig(kIndex_SrcDepth, true)); - REPORTER_ASSERT(reporter, configs[4] == this->getPrefConfig(k32Bit_SrcDepth, false)); - REPORTER_ASSERT(reporter, configs[5] == this->getPrefConfig(k32Bit_SrcDepth, true)); - } - -protected: - virtual bool onDecode(SkStream*, SkBitmap* bitmap, Mode) SK_OVERRIDE { - return false; - } -}; - -static void test_pref_config_table(skiatest::Reporter* reporter) { - PrefConfigTestingImageDecoder decoder; - decoder.testPrefConfigTable(reporter); -} - static void test_unpremul(skiatest::Reporter* reporter) { // This test cannot run if there is no resource path. SkString resourcePath = skiatest::Test::GetResourcePath(); @@ -264,7 +230,6 @@ extern void test_row_proc_choice(); static void test_imageDecodingTests(skiatest::Reporter* reporter) { test_unpremul(reporter); - test_pref_config_table(reporter); #ifdef SK_DEBUG test_stream_life(); test_row_proc_choice();