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

Unified Diff: src/codec/SkBmpStandardCodec.cpp

Issue 1911613002: Use SkEncodedInfo in place of SkSwizzler::SrcConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bmp bug Created 4 years, 8 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 | « include/codec/SkEncodedInfo.h ('k') | src/codec/SkGifCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkBmpStandardCodec.cpp
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp
index a509c75b6da8206bc42726bcc53b3b1cf69d2bdc..b2d8fc9735963cbec27a873a49ce9233c00d4a65 100644
--- a/src/codec/SkBmpStandardCodec.cpp
+++ b/src/codec/SkBmpStandardCodec.cpp
@@ -153,40 +153,20 @@ SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo,
}
void SkBmpStandardCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& opts) {
- // Get swizzler configuration
- SkSwizzler::SrcConfig config = SkSwizzler::kUnknown;
- switch (this->bitsPerPixel()) {
- case 1:
- config = SkSwizzler::kIndex1;
- break;
- case 2:
- config = SkSwizzler::kIndex2;
- break;
- case 4:
- config = SkSwizzler::kIndex4;
- break;
- case 8:
- config = SkSwizzler::kIndex;
- break;
- case 24:
- config = SkSwizzler::kBGR;
- break;
- case 32:
- if (fIsOpaque) {
- config = SkSwizzler::kBGRX;
- } else {
- config = SkSwizzler::kBGRA;
- }
- break;
- default:
- SkASSERT(false);
+ // In the case of paletted ico-in-bmps, we will report BGRA to the client,
+ // since we may be required to apply an alpha mask after the decode. But
+ // the swizzler needs to know the actual format of the bmp.
+ SkEncodedInfo swizzlerInfo = this->getEncodedInfo();
+ if (fInIco && this->bitsPerPixel() <= 8) {
+ swizzlerInfo = SkEncodedInfo::Make(SkEncodedInfo::kPalette_Color, swizzlerInfo.alpha(),
+ this->bitsPerPixel());
}
// Get a pointer to the color table if it exists
const SkPMColor* colorPtr = get_color_ptr(fColorTable.get());
// Create swizzler
- fSwizzler.reset(SkSwizzler::CreateSwizzler(config, colorPtr, dstInfo, opts));
+ fSwizzler.reset(SkSwizzler::CreateSwizzler(swizzlerInfo, colorPtr, dstInfo, opts));
SkASSERT(fSwizzler);
}
« no previous file with comments | « include/codec/SkEncodedInfo.h ('k') | src/codec/SkGifCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698