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

Unified Diff: src/images/SkImageDecoder_libwebp.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/images/SkImageDecoder_libpng.cpp ('k') | src/images/SkImageDecoder_pkm.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_libwebp.cpp
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index 353eabf015163ecf6f92ae8249a13ed8c71e4111..8baa10c454ec1d94db72690383f5829a62f4b6d1 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -278,40 +278,33 @@ static bool webp_get_config_resize_crop(WebPDecoderConfig* config,
return true;
}
-bool SkWEBPImageDecoder::setDecodeConfig(SkBitmap* decodedBitmap,
- int width, int height) {
- SkBitmap::Config config = this->getPrefConfig(k32Bit_SrcDepth, SkToBool(fHasAlpha));
+bool SkWEBPImageDecoder::setDecodeConfig(SkBitmap* decodedBitmap, int width, int height) {
+ SkColorType colorType = this->getPrefColorType(k32Bit_SrcDepth, SkToBool(fHasAlpha));
// YUV converter supports output in RGB565, RGBA4444 and RGBA8888 formats.
if (fHasAlpha) {
- if (config != SkBitmap::kARGB_4444_Config) {
- config = SkBitmap::kARGB_8888_Config;
+ if (colorType != kARGB_4444_SkColorType) {
+ colorType = kN32_SkColorType;
}
} else {
- if (config != SkBitmap::kRGB_565_Config &&
- config != SkBitmap::kARGB_4444_Config) {
- config = SkBitmap::kARGB_8888_Config;
+ if (colorType != kRGB_565_SkColorType && colorType != kARGB_4444_SkColorType) {
+ colorType = kN32_SkColorType;
}
}
- if (!this->chooseFromOneChoice(config, width, height)) {
+ if (!this->chooseFromOneChoice(colorType, width, height)) {
return false;
}
- SkImageInfo info;
- info.fWidth = width;
- info.fHeight = height;
- info.fColorType = SkBitmapConfigToColorType(config);
+ SkAlphaType alphaType = kOpaque_SkAlphaType;
if (SkToBool(fHasAlpha)) {
if (this->getRequireUnpremultipliedColors()) {
- info.fAlphaType = kUnpremul_SkAlphaType;
+ alphaType = kUnpremul_SkAlphaType;
} else {
- info.fAlphaType = kPremul_SkAlphaType;
+ alphaType = kPremul_SkAlphaType;
}
- } else {
- info.fAlphaType = kOpaque_SkAlphaType;
}
- return decodedBitmap->setInfo(info);
+ return decodedBitmap->setInfo(SkImageInfo::Make(width, height, colorType, alphaType));
}
bool SkWEBPImageDecoder::onBuildTileIndex(SkStreamRewindable* stream,
@@ -389,7 +382,7 @@ bool SkWEBPImageDecoder::onDecodeSubset(SkBitmap* decodedBitmap,
} else {
// This is also called in setDecodeConfig in above block.
// i.e., when bitmap->isNull() is true.
- if (!chooseFromOneChoice(bitmap->config(), width, height)) {
+ if (!chooseFromOneChoice(bitmap->colorType(), width, height)) {
return false;
}
}
« no previous file with comments | « src/images/SkImageDecoder_libpng.cpp ('k') | src/images/SkImageDecoder_pkm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698