Index: src/codec/SkBmpMaskCodec.cpp |
diff --git a/src/codec/SkBmpMaskCodec.cpp b/src/codec/SkBmpMaskCodec.cpp |
index 81067c7711bbb70177bd653dcc1d4cade892e5f3..336698d319d2e8f96c10a2b60da755040535f150 100644 |
--- a/src/codec/SkBmpMaskCodec.cpp |
+++ b/src/codec/SkBmpMaskCodec.cpp |
@@ -29,7 +29,8 @@ SkCodec::Result SkBmpMaskCodec::onGetPixels(const SkImageInfo& dstInfo, |
void* dst, size_t dstRowBytes, |
const Options& opts, |
SkPMColor* inputColorPtr, |
- int* inputColorCount) { |
+ int* inputColorCount, |
+ int* rowsDecoded) { |
if (opts.fSubset) { |
// Subsets are not supported. |
return kUnimplemented; |
@@ -49,7 +50,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()) { |
+ *rowsDecoded = rows; |
+ return kIncompleteInput; |
+ } |
+ return kSuccess; |
} |
bool SkBmpMaskCodec::initializeSwizzler(const SkImageInfo& dstInfo) { |
@@ -78,7 +84,7 @@ SkCodec::Result SkBmpMaskCodec::prepareToDecode(const SkImageInfo& dstInfo, |
/* |
* Performs the decoding |
*/ |
-SkCodec::Result SkBmpMaskCodec::decodeRows(const SkImageInfo& dstInfo, |
+int SkBmpMaskCodec::decodeRows(const SkImageInfo& dstInfo, |
void* dst, size_t dstRowBytes, |
const Options& opts) { |
// Iterate over rows of the image |
@@ -88,12 +94,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; |
} |
// Decode the row in destination format |
@@ -103,5 +104,5 @@ SkCodec::Result SkBmpMaskCodec::decodeRows(const SkImageInfo& dstInfo, |
} |
// Finished decoding the entire image |
- return kSuccess; |
+ return height; |
} |