mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-05 16:22:53 +00:00
Bug 336532: Animated gif with transparency shows black background, patch by Pawel Chmielowski <prefiks@aviary.pl>, r=stuart, sr=roc
This commit is contained in:
parent
7a5738d485
commit
e4ee90b452
@ -1016,7 +1016,7 @@ nsThebesRenderingContext::DrawImage(imgIContainer *aImage,
|
||||
}
|
||||
|
||||
return img->Draw(*this, mDrawingSurface,
|
||||
pxSr.x - pxImgFrameRect.x, pxSr.y - pxImgFrameRect.y,
|
||||
pxSr.x, pxSr.y,
|
||||
pxSr.width, pxSr.height,
|
||||
pxDr.x, pxDr.y, pxDr.width, pxDr.height);
|
||||
}
|
||||
|
@ -862,6 +862,29 @@ void imgContainerGIF::SetMaskVisibility(gfxIImageFrame *aFrame,
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_CAIRO_GFX
|
||||
PRUint8* alphaData;
|
||||
PRUint32 alphaDataLength;
|
||||
const PRUint8 setMaskTo = aVisible ? 0xFF : 0x00;
|
||||
|
||||
aFrame->LockImageData();
|
||||
nsresult res = aFrame->GetImageData(&alphaData, &alphaDataLength);
|
||||
if (NS_SUCCEEDED(res)) {
|
||||
#ifdef IS_LITTLE_ENDIAN
|
||||
alphaData += aY*frameWidth*4 + 3;
|
||||
#else
|
||||
alphaData += aY*frameWidth*4;
|
||||
#endif
|
||||
for (PRInt32 j = height; j > 0; --j) {
|
||||
for (PRInt32 i = (aX+width-1)*4; i >= aX; i -= 4) {
|
||||
alphaData[i] = setMaskTo;
|
||||
}
|
||||
alphaData += frameWidth*4;
|
||||
}
|
||||
}
|
||||
aFrame->UnlockImageData();
|
||||
|
||||
#else
|
||||
PRUint8* alphaData;
|
||||
PRUint32 alphaDataLength;
|
||||
aFrame->LockAlphaData();
|
||||
@ -946,6 +969,7 @@ void imgContainerGIF::SetMaskVisibility(gfxIImageFrame *aFrame,
|
||||
} // if aVisible
|
||||
|
||||
aFrame->UnlockAlphaData();
|
||||
#endif
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user