Index: src/codec/SkBmpMaskCodec.cpp |
diff --git a/src/codec/SkBmpMaskCodec.cpp b/src/codec/SkBmpMaskCodec.cpp |
index 3036f337b7f02b21803c70ff6b4ae3895d20edd0..5074a95f6550e9893be58ce33be82348424d0295 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* incompleteScanlines) { |
if (!this->rewindIfNeeded()) { |
return kCouldNotRewind; |
} |
@@ -52,7 +53,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()) { |
+ *incompleteScanlines = dstInfo.height() - rows; |
scroggo
2015/09/25 15:55:05
It's a little weird to me that onGetScanlines retu
msarett
2015/10/01 12:44:52
Done.
|
+ return kIncompleteInput; |
+ } |
+ return kSuccess; |
} |
bool SkBmpMaskCodec::initializeSwizzler(const SkImageInfo& dstInfo) { |
@@ -81,7 +87,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 +97,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 |
@@ -106,5 +107,5 @@ SkCodec::Result SkBmpMaskCodec::decodeRows(const SkImageInfo& dstInfo, |
} |
// Finished decoding the entire image |
- return kSuccess; |
+ return height; |
} |