Index: src/codec/SkBmpStandardCodec.cpp |
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp |
index 358da057c6e8a22ceea8dd9370e6b5da4982f961..651ff83b8a6450712219d41f43cba712698ad480 100644 |
--- a/src/codec/SkBmpStandardCodec.cpp |
+++ b/src/codec/SkBmpStandardCodec.cpp |
@@ -150,13 +150,18 @@ SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo, |
} |
void SkBmpStandardCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& opts) { |
- // 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. |
+ // In the case of bmp-in-icos, we will report BGRA to the client, |
+ // since we may be required to apply an alpha mask after the decode. |
+ // However, 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()); |
+ if (fInIco) { |
+ if (this->bitsPerPixel() <= 8) { |
+ swizzlerInfo = SkEncodedInfo::Make(SkEncodedInfo::kPalette_Color, |
+ swizzlerInfo.alpha(), this->bitsPerPixel()); |
+ } else if (this->bitsPerPixel() == 24) { |
+ swizzlerInfo = SkEncodedInfo::Make(SkEncodedInfo::kBGR_Color, |
+ SkEncodedInfo::kOpaque_Alpha, 8); |
+ } |
} |
// Get a pointer to the color table if it exists |