Bug 1217465 - Fill in missing pixels caused by truncated BMP files. r=seth.

This fixes failures for
image/test/reftest/bmp/bmpsuite/b/{badrle.bmp,shortfile.bmp} with the Skia
back-end.

--HG--
extra : rebase_source : 6c5b967cebf43cf5d49d0e532619bdd1c8ccc69e
This commit is contained in:
Nicholas Nethercote 2015-11-15 20:31:07 -08:00
Родитель 545885b406
Коммит 8b78d5e498
2 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -240,6 +240,17 @@ nsBMPDecoder::FinishInternal()
// Send notifications if appropriate.
if (!IsMetadataDecode() && HasSize()) {
// If it was truncated, fill in the missing pixels as black.
while (mCurrentRow > 0) {
uint32_t* dst = RowBuffer();
while (mCurrentPos < mH.mWidth) {
SetPixel(dst, 0, 0, 0);
mCurrentPos++;
}
mCurrentPos = 0;
FinishRow();
}
// Invalidate.
nsIntRect r(0, 0, mH.mWidth, AbsoluteHeight());
PostInvalidation(r);

Просмотреть файл

@ -230,8 +230,9 @@ private:
int32_t mCurrentRow; // Index of the row of the image that's currently
// being decoded: [height,1].
int32_t mCurrentPos; // Index into the current line; only used when
// doing RLE decoding.
int32_t mCurrentPos; // Index into the current line. Used when
// doing RLE decoding and when filling in pixels
// for truncated files.
// Only used in RLE_ABSOLUTE state: the number of pixels to read.
uint32_t mAbsoluteModeNumPixels;