mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 06:22:20 +00:00
Bug 229836 - map illegal index values to black. r=paper, sr=blizzard
This commit is contained in:
parent
002e4c216a
commit
0cefdcff39
@ -460,19 +460,25 @@ int nsGIFDecoder2::HaveDecodedRow(
|
||||
case gfxIFormats::BGR:
|
||||
{
|
||||
while (rowBufIndex != decoder->mGIFStruct->rowend) {
|
||||
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
|
||||
if (*rowBufIndex < cmapsize) {
|
||||
PRUint32 colorIndex = *rowBufIndex * 3;
|
||||
#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
|
||||
*rgbRowIndex++ = cmap[colorIndex]; // red
|
||||
*rgbRowIndex++ = cmap[colorIndex + 1]; // green
|
||||
*rgbRowIndex++ = cmap[colorIndex + 2]; // blue
|
||||
#endif
|
||||
} else {
|
||||
*rgbRowIndex++ = 0; // red
|
||||
*rgbRowIndex++ = 0; // green
|
||||
*rgbRowIndex++ = 0; // blue
|
||||
}
|
||||
++rowBufIndex;
|
||||
}
|
||||
for (int i=0; i<aDuplicateCount; i++) {
|
||||
@ -488,19 +494,25 @@ int nsGIFDecoder2::HaveDecodedRow(
|
||||
memset(decoder->mAlphaLine, 0, abpr);
|
||||
for (PRUint32 x = 0; x < (PRUint32)width; ++x) {
|
||||
if (*rowBufIndex != decoder->mGIFStruct->tpixel) {
|
||||
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
|
||||
if (*rowBufIndex < cmapsize) {
|
||||
PRUint32 colorIndex = *rowBufIndex * 3;
|
||||
#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
|
||||
*rgbRowIndex++ = cmap[colorIndex]; // red
|
||||
*rgbRowIndex++ = cmap[colorIndex + 1]; // green
|
||||
*rgbRowIndex++ = cmap[colorIndex + 2]; // blue
|
||||
#endif
|
||||
} else {
|
||||
*rgbRowIndex++ = 0; // red
|
||||
*rgbRowIndex++ = 0; // green
|
||||
*rgbRowIndex++ = 0; // blue
|
||||
}
|
||||
decoder->mAlphaLine[x>>3] |= 1<<(7-x&0x7);
|
||||
} else {
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
|
Loading…
x
Reference in New Issue
Block a user