| Index: src/codec/SkBmpStandardCodec.cpp
|
| diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp
|
| index 59bc917481698fb0a3caf5dab456312ac85631d7..7360bef37b40b89941262562d178bbfc838ac4fc 100644
|
| --- a/src/codec/SkBmpStandardCodec.cpp
|
| +++ b/src/codec/SkBmpStandardCodec.cpp
|
| @@ -58,9 +58,10 @@ SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo,
|
| if (kSuccess != result) {
|
| return result;
|
| }
|
| - result = this->decodeRows(dstInfo, dst, dstRowBytes, opts);
|
| - if (kSuccess != result) {
|
| - return result;
|
| + uint32_t rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts);
|
| + if (rows != dstInfo.height()) {
|
| + this->setIncompleteScanlines(dstInfo.height() - rows);
|
| + return kIncompleteInput;
|
| }
|
| if (fInIco) {
|
| return this->decodeIcoMask(dstInfo, dst, dstRowBytes);
|
| @@ -231,7 +232,7 @@ SkCodec::Result SkBmpStandardCodec::prepareToDecode(const SkImageInfo& dstInfo,
|
| /*
|
| * Performs the bitmap decoding for standard input format
|
| */
|
| -SkCodec::Result SkBmpStandardCodec::decodeRows(const SkImageInfo& dstInfo,
|
| +uint32_t SkBmpStandardCodec::decodeRows(const SkImageInfo& dstInfo,
|
| void* dst, size_t dstRowBytes,
|
| const Options& opts) {
|
| // Iterate over rows of the image
|
| @@ -240,13 +241,7 @@ SkCodec::Result SkBmpStandardCodec::decodeRows(const SkImageInfo& dstInfo,
|
| // Read a row of the input
|
| if (this->stream()->read(fSrcBuffer.get(), fSrcRowBytes) != fSrcRowBytes) {
|
| SkCodecPrintf("Warning: incomplete input stream.\n");
|
| - // Fill the destination image on failure
|
| - void* dstStart = this->getDstStartRow(dst, dstRowBytes, y);
|
| - const SkPMColor* colorPtr = get_color_ptr(fColorTable.get());
|
| - uint32_t fillColorOrIndex = get_fill_color_or_index(dstInfo.alphaType());
|
| - SkSwizzler::Fill(dstStart, dstInfo, dstRowBytes, dstInfo.height() - y,
|
| - fillColorOrIndex, colorPtr, opts.fZeroInitialized);
|
| - return kIncompleteInput;
|
| + return y;
|
| }
|
|
|
| // Decode the row in destination format
|
| @@ -257,7 +252,7 @@ SkCodec::Result SkBmpStandardCodec::decodeRows(const SkImageInfo& dstInfo,
|
| }
|
|
|
| // Finished decoding the entire image
|
| - return kSuccess;
|
| + return height;
|
| }
|
|
|
| // TODO (msarett): This function will need to be modified in order to perform row by row decodes
|
| @@ -298,3 +293,11 @@ SkCodec::Result SkBmpStandardCodec::decodeIcoMask(const SkImageInfo& dstInfo,
|
| }
|
| return kSuccess;
|
| }
|
| +
|
| +uint32_t SkBmpStandardCodec::onGetFillValue(const SkImageInfo& dstInfo) const {
|
| + const SkPMColor* colorPtr = get_color_ptr(fColorTable.get());
|
| + if (colorPtr) {
|
| + return get_color_table_fill_value(dstInfo.colorType(), colorPtr, 0);
|
| + }
|
| + return INHERITED::onGetFillValue(dstInfo);
|
| +}
|
|
|