Bug 208622 - some animated gifs don't display properly. r=pavlov, sr=scc
git-svn-id: svn://10.0.0.236/trunk@145177 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
f668898cba
commit
75f32461a1
@ -301,16 +301,10 @@ static int do_lzw(gif_struct *gs, const PRUint8 *q)
|
||||
PRUint8 *rowp = gs->rowp;
|
||||
PRUint8 *rowend = gs->rowend;
|
||||
PRUintn rows_remaining = gs->rows_remaining;
|
||||
PRUint8 max_index;
|
||||
|
||||
if (rowp == rowend)
|
||||
return 0;
|
||||
|
||||
if (gs->is_local_colormap_defined)
|
||||
max_index = gs->local_colormap_size - 1;
|
||||
else
|
||||
max_index = gs->global_colormap_size - 1;
|
||||
|
||||
#define OUTPUT_ROW(gs) \
|
||||
PR_BEGIN_MACRO \
|
||||
output_row(gs); \
|
||||
@ -348,11 +342,7 @@ static int do_lzw(gif_struct *gs, const PRUint8 *q)
|
||||
return 0;
|
||||
|
||||
if (oldcode == -1) {
|
||||
*rowp = suffix[code];
|
||||
if (*rowp > max_index)
|
||||
*rowp = 0;
|
||||
rowp++;
|
||||
|
||||
*rowp++ = suffix[code];
|
||||
if (rowp == rowend)
|
||||
OUTPUT_ROW(gs);
|
||||
|
||||
@ -406,11 +396,7 @@ static int do_lzw(gif_struct *gs, const PRUint8 *q)
|
||||
|
||||
/* Copy the decoded data out to the scanline buffer. */
|
||||
do {
|
||||
*rowp = *--stackp;
|
||||
if (*rowp > max_index)
|
||||
*rowp = 0;
|
||||
rowp++;
|
||||
|
||||
*rowp++ = *--stackp;
|
||||
if (rowp == rowend) {
|
||||
OUTPUT_ROW(gs);
|
||||
}
|
||||
|
||||
@ -457,15 +457,22 @@ int nsGIFDecoder2::HaveDecodedRow(
|
||||
|
||||
switch (format) {
|
||||
case gfxIFormats::RGB:
|
||||
case gfxIFormats::BGR:
|
||||
{
|
||||
while (rowBufIndex != decoder->mGIFStruct->rowend) {
|
||||
PRUint32 colorIndex = *rowBufIndex * 3;
|
||||
PRUint32 colorIndex = (*rowBufIndex < cmapsize) ? (*rowBufIndex * 3) : 0;
|
||||
#if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)
|
||||
*rgbRowIndex++ = cmap[colorIndex + 2]; // blue
|
||||
*rgbRowIndex++ = cmap[colorIndex + 1]; // green
|
||||
*rgbRowIndex++ = cmap[colorIndex]; // red
|
||||
#else
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
*rgbRowIndex++ = 0; // Mac is always 32bits per pixel, this is pad
|
||||
#endif
|
||||
*rgbRowIndex++ = cmap[colorIndex]; // red
|
||||
*rgbRowIndex++ = cmap[colorIndex + 1]; // green
|
||||
*rgbRowIndex++ = cmap[colorIndex + 2]; // blue
|
||||
#endif
|
||||
++rowBufIndex;
|
||||
}
|
||||
for (int i=0; i<aDuplicateCount; i++) {
|
||||
@ -474,21 +481,6 @@ int nsGIFDecoder2::HaveDecodedRow(
|
||||
}
|
||||
break;
|
||||
}
|
||||
case gfxIFormats::BGR:
|
||||
{
|
||||
while (rowBufIndex != decoder->mGIFStruct->rowend) {
|
||||
PRUint32 colorIndex = *rowBufIndex * 3;
|
||||
*rgbRowIndex++ = cmap[colorIndex + 2]; // blue
|
||||
*rgbRowIndex++ = cmap[colorIndex + 1]; // green
|
||||
*rgbRowIndex++ = cmap[colorIndex]; // red
|
||||
++rowBufIndex;
|
||||
}
|
||||
for (int i = 0; i < aDuplicateCount; ++i) {
|
||||
decoder->mImageFrame->SetImageData(decoder->mRGBLine,
|
||||
bpr, (aRowNumber+i)*bpr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case gfxIFormats::RGB_A1:
|
||||
case gfxIFormats::BGR_A1:
|
||||
{
|
||||
@ -496,7 +488,7 @@ int nsGIFDecoder2::HaveDecodedRow(
|
||||
memset(decoder->mAlphaLine, 0, abpr);
|
||||
for (PRUint32 x = 0; x < (PRUint32)width; ++x) {
|
||||
if (*rowBufIndex != decoder->mGIFStruct->tpixel) {
|
||||
PRUint32 colorIndex = *rowBufIndex * 3;
|
||||
PRUint32 colorIndex = (*rowBufIndex < cmapsize) ? (*rowBufIndex * 3) : 0;
|
||||
#if defined(XP_WIN) || defined(XP_OS2) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)
|
||||
*rgbRowIndex++ = cmap[colorIndex + 2]; // blue
|
||||
*rgbRowIndex++ = cmap[colorIndex + 1]; // green
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user