Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Unified Diff: src/images/SkImageDecoder.cpp

Issue 137753017: move all Config specific APIs into SkBitmapConfig.cpp -- Config is deprecated (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | src/pdf/SkPDFDeviceFlattener.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | src/pdf/SkPDFDeviceFlattener.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698