Fix filling of incomplete images in SkSampledCodec
The bug occurs when filling after an incomplete sampled/subset
incremental decode.
I'm also adding many truncated test pngs.
BUG=skia:5769
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2343153003
Review-Url: https://codereview.chromium.org/2343153003
diff --git a/infra/bots/assets/skimage/VERSION b/infra/bots/assets/skimage/VERSION
index c793025..301160a 100644
--- a/infra/bots/assets/skimage/VERSION
+++ b/infra/bots/assets/skimage/VERSION
@@ -1 +1 @@
-7
\ No newline at end of file
+8
\ No newline at end of file
diff --git a/src/codec/SkSampledCodec.cpp b/src/codec/SkSampledCodec.cpp
index 403b42f..cca2600 100644
--- a/src/codec/SkSampledCodec.cpp
+++ b/src/codec/SkSampledCodec.cpp
@@ -257,10 +257,11 @@
return SkCodec::kSuccess;
}
SkASSERT(incResult == SkCodec::kIncompleteInput);
- const int lastRowInOutput = (rowsDecoded - startY) / sampleY;
- // FIXME: Should this be info or nativeInfo? Does it make a difference?
+
+ // Count the rows that we decoded, and also did not skip.
+ const int trueRowsDecoded = (rowsDecoded + sampleY - 1) / sampleY;
this->codec()->fillIncompleteImage(info, pixels, rowBytes, options.fZeroInitialized,
- info.height(), lastRowInOutput);
+ info.height(), trueRowsDecoded);
return SkCodec::kIncompleteInput;
} else if (startResult != SkCodec::kUnimplemented) {
return startResult;