diff --git a/mozilla/gfx/src/thebes/nsThebesRenderingContext.cpp b/mozilla/gfx/src/thebes/nsThebesRenderingContext.cpp index b762279e09b..5e5218f3718 100644 --- a/mozilla/gfx/src/thebes/nsThebesRenderingContext.cpp +++ b/mozilla/gfx/src/thebes/nsThebesRenderingContext.cpp @@ -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); } diff --git a/mozilla/modules/libpr0n/decoders/gif/imgContainerGIF.cpp b/mozilla/modules/libpr0n/decoders/gif/imgContainerGIF.cpp index 38a3c30c6e7..8ef4b83bfba 100644 --- a/mozilla/modules/libpr0n/decoders/gif/imgContainerGIF.cpp +++ b/mozilla/modules/libpr0n/decoders/gif/imgContainerGIF.cpp @@ -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 } //******************************************************************************