Bug 610601 - re-use the frame only if there is image data. r+a=joe

This commit is contained in:
Mats Palmgren 2010-12-08 03:20:52 +01:00
Родитель c2163496cc
Коммит 702b90e2aa
1 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -918,22 +918,22 @@ RasterImage::EnsureCleanFrame(PRUint32 aFrameNum, PRInt32 aX, PRInt32 aY,
// See if we can re-use the frame that already exists.
nsIntRect rect = frame->GetRect();
if (rect.x != aX || rect.y != aY || rect.width != aWidth || rect.height != aHeight ||
frame->GetFormat() != aFormat) {
DeleteImgFrame(aFrameNum);
return InternalAddFrame(aFrameNum, aX, aY, aWidth, aHeight, aFormat,
/* aPaletteDepth = */ 0, imageData, imageLength,
/* aPaletteData = */ nsnull,
/* aPaletteLength = */ nsnull);
if (rect.x == aX && rect.y == aY && rect.width == aWidth &&
rect.height == aHeight && frame->GetFormat() == aFormat) {
// We can re-use the frame if it has image data.
frame->GetImageData(imageData, imageLength);
if (*imageData) {
return NS_OK;
}
}
// We can re-use the frame.
frame->GetImageData(imageData, imageLength);
return NS_OK;
DeleteImgFrame(aFrameNum);
return InternalAddFrame(aFrameNum, aX, aY, aWidth, aHeight, aFormat,
/* aPaletteDepth = */ 0, imageData, imageLength,
/* aPaletteData = */ nsnull,
/* aPaletteLength = */ nsnull);
}
void
RasterImage::FrameUpdated(PRUint32 aFrameNum, nsIntRect &aUpdatedRect)
{