Chromium Code Reviews| Index: src/codec/SkBmpCodec.cpp |
| diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp |
| index 3302e4f752eb74826b6142d1d3e04535e393f816..f5a87709f779b25d4f4bba4abd160af46e62fe3f 100644 |
| --- a/src/codec/SkBmpCodec.cpp |
| +++ b/src/codec/SkBmpCodec.cpp |
| @@ -472,6 +472,14 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) { |
| } |
| if (codecOut) { |
| + // BMPs-in-ICOs contain an alpha mask after the image which means we |
| + // cannot guarantee that an image is opaque, even if the bmp thinks |
| + // it is. |
| + bool isOpaque = kOpaque_SkAlphaType == alphaType; |
|
msarett
2016/02/11 16:50:15
Here we need to remember if the embedded BMP is ac
scroggo
2016/02/11 18:05:13
This seems simple enough to me.
msarett
2016/02/11 18:15:47
Acknowledged.
|
| + if (inIco) { |
| + alphaType = kUnpremul_SkAlphaType; |
| + } |
| + |
| // Set the image info |
| const SkImageInfo& imageInfo = SkImageInfo::Make(width, height, |
| colorType, alphaType); |
| @@ -482,7 +490,7 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) { |
| // We require streams to have a memory base for Bmp-in-Ico decodes. |
| SkASSERT(!inIco || nullptr != stream->getMemoryBase()); |
| *codecOut = new SkBmpStandardCodec(imageInfo, stream, bitsPerPixel, numColors, |
| - bytesPerColor, offset - bytesRead, rowOrder, inIco); |
| + bytesPerColor, offset - bytesRead, rowOrder, isOpaque, inIco); |
| return true; |
| case kBitMask_BmpInputFormat: |
| // Bmp-in-Ico must be standard mode |