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
This commit is contained in:
parent
bdb677a277
commit
a0b266d817
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user