Index: src/images/SkImageDecoder.cpp |
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp |
index 32cf087ed86514ea341f819847f5254b0ffe1476..054ada2bc5e25e74e73526672558949a5d2ec99e 100644 |
--- a/src/images/SkImageDecoder.cpp |
+++ b/src/images/SkImageDecoder.cpp |
@@ -16,6 +16,7 @@ |
static SkBitmap::Config gDeviceConfig = SkBitmap::kNo_Config; |
+#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CONFIG |
SkBitmap::Config SkImageDecoder::GetDeviceConfig() |
{ |
return gDeviceConfig; |
@@ -25,6 +26,7 @@ void SkImageDecoder::SetDeviceConfig(SkBitmap::Config config) |
{ |
gDeviceConfig = config; |
} |
+#endif |
/////////////////////////////////////////////////////////////////////////////// |
@@ -120,15 +122,22 @@ void SkImageDecoder::setSampleSize(int size) { |
fSampleSize = size; |
} |
+#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CONFIG |
bool SkImageDecoder::chooseFromOneChoice(SkBitmap::Config config, int width, |
int height) const { |
+ return this->chooseFromOneChoice(SkBitmapConfigToColorType(config), |
+ width, height); |
+} |
+#endif |
+bool SkImageDecoder::chooseFromOneChoice(SkColorType colorType, |
+ int width, int height) const { |
Chooser* chooser = fChooser; |
- |
+ |
if (NULL == chooser) { // no chooser, we just say YES to decoding :) |
return true; |
} |
chooser->begin(1); |
- chooser->inspect(0, config, width, height); |
+ chooser->inspect(0, colorType, width, height); |
return chooser->choose() == 0; |
} |
@@ -172,13 +181,20 @@ SkBitmap::Config SkImageDecoder::getPrefConfig(SrcDepth srcDepth, |
return config; |
} |
+#ifdef SK_SUPPORT_LEGACY_IMAGEDECODER_CONFIG |
bool SkImageDecoder::decode(SkStream* stream, SkBitmap* bm, |
SkBitmap::Config pref, Mode mode) { |
+ return this->decode(stream, bm, SkBitmapConfigToColorType(pref), mode); |
+} |
+#endif |
+ |
+bool SkImageDecoder::decode(SkStream* stream, SkBitmap* bm, |
+ SkColorType colorType, Mode mode) { |
// we reset this to false before calling onDecode |
fShouldCancelDecode = false; |
// assign this, for use by getPrefConfig(), in case fUsePrefTable is false |
- fDefaultPref = pref; |
- |
+ fDefaultColorType = colorType; |
+ |
// pass a temporary bitmap, so that if we return false, we are assured of |
// leaving the caller's bitmap untouched. |
SkBitmap tmp; |