Chromium Code Reviews| Index: src/codec/SkBmpCodec.cpp |
| diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp |
| index 4383382d8a60a729686be58c2e34f4705ebf8d83..92aa2c37989579b74c94a07f159bc71aade12254 100644 |
| --- a/src/codec/SkBmpCodec.cpp |
| +++ b/src/codec/SkBmpCodec.cpp |
| @@ -478,6 +478,7 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) { |
| case kBitMask_BmpInputFormat: |
| // Bmp-in-Ico must be standard mode |
| if (inIco) { |
|
msarett
2015/08/11 22:35:03
Turns out this is reachable and we have a test now
|
| + SkCodecPrintf("Error: Icos may not use bit mask format.\n"); |
| return false; |
| } |
| // Skip to the start of the pixel array. |
| @@ -493,9 +494,10 @@ bool SkBmpCodec::ReadHeader(SkStream* stream, bool inIco, SkCodec** codecOut) { |
| return true; |
| case kRLE_BmpInputFormat: |
| // Bmp-in-Ico must be standard mode |
| - if (inIco) { |
| - return false; |
| - } |
| + // This line should be unreachable, since we require that |
|
scroggo
2015/08/12 14:14:30
nit: this line is reachable - it just shouldn't be
msarett
2015/08/12 15:01:24
Haha yep. Fixing the comment.
|
| + // RLE Bmps have a valid number of totalBytes, and Icos skip |
| + // the header that contains totalBytes. |
| + SkASSERT(!inIco); |
|
msarett
2015/08/11 22:35:03
I discovered that this is unreachable when trying
|
| *codecOut = SkNEW_ARGS(SkBmpRLECodec, ( |
| imageInfo, stream, bitsPerPixel, numColors, |
| bytesPerColor, offset - bytesRead, rowOrder, RLEBytes)); |
| @@ -564,7 +566,7 @@ void* SkBmpCodec::getDstStartRow(void* dst, size_t dstRowBytes, int32_t y) const |
| */ |
| uint32_t SkBmpCodec::computeNumColors(uint32_t numColors) { |
| // Zero is a default for maxColors |
| - // Also set fNumColors to maxColors when it is too large |
| + // Also set numColors to maxColors when it is too large |
| uint32_t maxColors = 1 << fBitsPerPixel; |
| if (numColors == 0 || numColors >= maxColors) { |
| return maxColors; |