Bug 795722 - Clear our cached ImageContainer when the imgFrame changes. r=joe

This commit is contained in:
Matt Woodrow 2012-10-02 17:01:25 +13:00
parent 1c469a0cf7
commit 10c1bdf174

View File

@ -943,6 +943,10 @@ RasterImage::GetCurrentImage()
nsresult rv = GetFrame(FRAME_CURRENT, FLAG_SYNC_DECODE, getter_AddRefs(imageSurface));
NS_ENSURE_SUCCESS(rv, nullptr);
if (!mImageContainer) {
mImageContainer = LayerManager::CreateImageContainer();
}
CairoImage::Data cairoData;
cairoData.mSurface = imageSurface;
GetWidth(&cairoData.mSize.width);
@ -968,8 +972,6 @@ RasterImage::GetImageContainer(ImageContainer **_retval)
return NS_OK;
}
mImageContainer = LayerManager::CreateImageContainer();
nsRefPtr<layers::Image> image = GetCurrentImage();
if (!image) {
return NS_ERROR_FAILURE;
@ -1292,9 +1294,9 @@ RasterImage::FrameUpdated(uint32_t aFrameNum, nsIntRect &aUpdatedRect)
frame->ImageUpdated(aUpdatedRect);
if (aFrameNum == GetCurrentImgFrameIndex()) {
// The image has changed, so we need to invalidate our cached ImageContainer.
UpdateImageContainer();
if (aFrameNum == GetCurrentImgFrameIndex() &&
!IsInUpdateImageContainer()) {
mImageContainer = nullptr;
}
}