Chromium Code Reviews| Index: src/codec/SkBmpMaskCodec.cpp |
| diff --git a/src/codec/SkBmpMaskCodec.cpp b/src/codec/SkBmpMaskCodec.cpp |
| index 3036f337b7f02b21803c70ff6b4ae3895d20edd0..f18507755fd404b6053aaed93f0445d68993149b 100644 |
| --- a/src/codec/SkBmpMaskCodec.cpp |
| +++ b/src/codec/SkBmpMaskCodec.cpp |
| @@ -52,7 +52,12 @@ SkCodec::Result SkBmpMaskCodec::onGetPixels(const SkImageInfo& dstInfo, |
| return result; |
| } |
| - return this->decodeRows(dstInfo, dst, dstRowBytes, opts); |
| + uint32_t rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts); |
| + if (rows != dstInfo.height()) { |
| + this->setIncompleteScanlines(dstInfo.height() - rows); |
| + return kIncompleteInput; |
| + } |
| + return kSuccess; |
| } |
| bool SkBmpMaskCodec::initializeSwizzler(const SkImageInfo& dstInfo) { |
| @@ -81,7 +86,7 @@ SkCodec::Result SkBmpMaskCodec::prepareToDecode(const SkImageInfo& dstInfo, |
| /* |
| * Performs the decoding |
| */ |
| -SkCodec::Result SkBmpMaskCodec::decodeRows(const SkImageInfo& dstInfo, |
| +uint32_t SkBmpMaskCodec::decodeRows(const SkImageInfo& dstInfo, |
| void* dst, size_t dstRowBytes, |
| const Options& opts) { |
| // Iterate over rows of the image |
| @@ -91,12 +96,7 @@ SkCodec::Result SkBmpMaskCodec::decodeRows(const SkImageInfo& dstInfo, |
| // Read a row of the input |
| if (this->stream()->read(srcRow, fSrcRowBytes) != fSrcRowBytes) { |
| SkCodecPrintf("Warning: incomplete input stream.\n"); |
| - // Fill the destination image on failure |
| - void* dstStart = this->getDstStartRow(dst, dstRowBytes, y); |
| - uint32_t fillColor = get_fill_color_or_index(dstInfo.alphaType()); |
| - SkSwizzler::Fill(dstStart, dstInfo, dstRowBytes, height - y, |
| - fillColor, nullptr, opts.fZeroInitialized); |
| - return kIncompleteInput; |
| + return y; |
|
scroggo
2015/09/22 18:02:48
It seems like we could have called Fill here, righ
msarett
2015/09/23 13:22:40
Yes. It was my intention to make getPixels() take
|
| } |
| // Decode the row in destination format |
| @@ -106,5 +106,5 @@ SkCodec::Result SkBmpMaskCodec::decodeRows(const SkImageInfo& dstInfo, |
| } |
| // Finished decoding the entire image |
| - return kSuccess; |
| + return height; |
| } |