Fix bug in sampled decodes

BUG=skia:

Review URL: https://codereview.chromium.org/1417993006
This commit is contained in:
msarett 2015-11-05 11:19:29 -08:00 committed by Commit bot
parent 5d7a7fe563
commit 691ad76fca

View File

@ -215,11 +215,12 @@ SkCodec::Result SkSampledCodec::sampledDecode(const SkImageInfo& info, void* pix
dstHeight, y + 1);
return SkCodec::kIncompleteInput;
}
int linesToSkip = SkTMin(sampleY - 1, dstHeight - y - 1);
if (!fCodec->skipScanlines(linesToSkip)) {
fCodec->fillIncompleteImage(info, pixels, rowBytes, options.fZeroInitialized,
dstHeight, y + 1);
return SkCodec::kIncompleteInput;
if (y < dstHeight - 1) {
if (!fCodec->skipScanlines(sampleY - 1)) {
fCodec->fillIncompleteImage(info, pixels, rowBytes,
options.fZeroInitialized, dstHeight, y + 1);
return SkCodec::kIncompleteInput;
}
}
pixelPtr = SkTAddOffset<void>(pixelPtr, rowBytes);
}