Bug 519589 - Restore our handling of transparent pixels outside the colormap's bounds. p=alfredkayser@gmail.com r=joe a=ss
git-svn-id: svn://10.0.0.236/trunk@258685 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
9c199e8e7e
commit
64af0d6514
@ -1058,14 +1058,13 @@ nsresult nsGIFDecoder2::GifWrite(const PRUint8 *buf, PRUint32 len)
|
||||
PRUint32 depth = mGIFStruct.global_colormap_depth;
|
||||
if (q[8] & 0x80)
|
||||
depth = (q[8]&0x07) + 1;
|
||||
// Make sure the transparent pixel is within colormap space
|
||||
if (mGIFStruct.tpixel >= (1 << depth)) {
|
||||
mGIFStruct.is_transparent = PR_FALSE;
|
||||
mGIFStruct.tpixel = 0;
|
||||
}
|
||||
PRUint32 realDepth = depth;
|
||||
while (mGIFStruct.tpixel >= (1 << realDepth) && (realDepth < 8)) {
|
||||
realDepth++;
|
||||
}
|
||||
// Mask to limit the color values within the colormap
|
||||
mColorMask = 0xFF >> (8 - depth);
|
||||
BeginImageFrame(depth);
|
||||
mColorMask = 0xFF >> (8 - realDepth);
|
||||
BeginImageFrame(realDepth);
|
||||
if (!mImageData) {
|
||||
mGIFStruct.state = gif_error;
|
||||
break;
|
||||
@ -1100,7 +1099,7 @@ nsresult nsGIFDecoder2::GifWrite(const PRUint8 *buf, PRUint32 len)
|
||||
} else {
|
||||
// First frame has local colormap, allocate space for it
|
||||
// as the image frame doesn't have its own palette
|
||||
paletteSize = sizeof(PRUint32) << depth;
|
||||
paletteSize = sizeof(PRUint32) << realDepth;
|
||||
if (!mGIFStruct.local_colormap) {
|
||||
mGIFStruct.local_colormap = (PRUint32*)PR_MALLOC(paletteSize);
|
||||
if (!mGIFStruct.local_colormap) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user