Index: src/codec/SkBmpStandardCodec.cpp |
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp |
index 358da057c6e8a22ceea8dd9370e6b5da4982f961..258a6f779c73cc8c9acc05bca39c13605b128a95 100644 |
--- a/src/codec/SkBmpStandardCodec.cpp |
+++ b/src/codec/SkBmpStandardCodec.cpp |
@@ -150,13 +150,23 @@ 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 ico-in-bmps, we will report BGRA to the client, |
scroggo
2016/05/04 13:02:19
nit: Shouldn't this be bmp-in-icos?
msarett
2016/05/04 19:27:49
Done.
|
+ // 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) { |
+ switch (this->bitsPerPixel()) { |
+ case 8: |
scroggo
2016/05/04 13:02:19
We used to handle <= 8. I take it < was unnecessar
msarett
2016/05/04 19:27:49
Nice catch! This is me trying to introduce a new
|
+ swizzlerInfo = SkEncodedInfo::Make(SkEncodedInfo::kPalette_Color, |
+ swizzlerInfo.alpha(), this->bitsPerPixel()); |
scroggo
2016/05/04 13:02:19
8?
msarett
2016/05/04 19:27:49
It could be 1, 2, 4, or 8.
|
+ break; |
+ case 24: |
+ swizzlerInfo = SkEncodedInfo::Make(SkEncodedInfo::kBGR_Color, |
+ SkEncodedInfo::kOpaque_Alpha, swizzlerInfo.bitsPerComponent()); |
scroggo
2016/05/04 13:02:19
Why do you need to check bitsPerComponent here? Wi
msarett
2016/05/04 19:27:49
It will always be 8. I'll put 8.
|
+ break; |
+ default: |
+ break; |
+ } |
} |
// Get a pointer to the color table if it exists |