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

Unified Diff: src/images/SkImageDecoder.cpp

Issue 322963002: hide SkBitmap::setConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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/gpu/SkGpuDevice.cpp ('k') | src/images/SkImageDecoder_ktx.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 491d9aa72f9124b430148316d8ad37c7873a75ac..5d38b40412f6700073841c9b66a4bc7e600193b4 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -124,15 +124,16 @@ void SkImageDecoder::setSampleSize(int size) {
fSampleSize = size;
}
-bool SkImageDecoder::chooseFromOneChoice(SkBitmap::Config config, int width,
- int height) const {
+// TODO: change Chooser virtual to take colorType, so we can stop calling SkColorTypeToBitmapConfig
+//
+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, SkColorTypeToBitmapConfig(colorType), width, height);
return chooser->choose() == 0;
}
@@ -148,8 +149,10 @@ void SkImageDecoder::setPrefConfigTable(const PrefConfigTable& prefTable) {
fPrefTable = prefTable;
}
-SkBitmap::Config SkImageDecoder::getPrefConfig(SrcDepth srcDepth,
- bool srcHasAlpha) const {
+// TODO: use colortype in fPrefTable, fDefaultPref and GetDeviceConfig()
+// so we can stop using SkBitmapConfigToColorType()
+//
+SkColorType SkImageDecoder::getPrefColorType(SrcDepth srcDepth, bool srcHasAlpha) const {
SkBitmap::Config config = SkBitmap::kNo_Config;
if (fUsePrefTable) {
@@ -173,7 +176,7 @@ SkBitmap::Config SkImageDecoder::getPrefConfig(SrcDepth srcDepth,
if (SkBitmap::kNo_Config == config) {
config = SkImageDecoder::GetDeviceConfig();
}
- return config;
+ return SkBitmapConfigToColorType(config);
}
bool SkImageDecoder::decode(SkStream* stream, SkBitmap* bm,
@@ -232,7 +235,7 @@ bool SkImageDecoder::cropBitmap(SkBitmap *dst, SkBitmap *src, int sampleSize,
}
// if the destination has no pixels then we must allocate them.
if (dst->isNull()) {
- dst->setConfig(src->config(), w, h, 0, src->alphaType());
+ dst->setInfo(src->info().makeWH(w, h));
if (!this->allocPixelRef(dst, NULL)) {
SkDEBUGF(("failed to allocate pixels needed to crop the bitmap"));
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/images/SkImageDecoder_ktx.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698