Bug 672578 - Part 1. Don't trigger a decode when FrameUpdated is called. r=joe

This commit is contained in:
Justin Lebar 2011-07-21 14:14:41 -04:00
parent 1800d8f336
commit ea250e229a
2 changed files with 11 additions and 5 deletions

View File

@ -452,11 +452,8 @@ RasterImage::GetType()
}
imgFrame*
RasterImage::GetImgFrame(PRUint32 framenum)
RasterImage::GetImgFrameNoDecode(PRUint32 framenum)
{
nsresult rv = WantDecodedFrames();
CONTAINER_ENSURE_TRUE(NS_SUCCEEDED(rv), nsnull);
if (!mAnim) {
NS_ASSERTION(framenum == 0, "Don't ask for a frame > 0 if we're not animated!");
return mFrames.SafeElementAt(0, nsnull);
@ -466,6 +463,14 @@ RasterImage::GetImgFrame(PRUint32 framenum)
return mFrames.SafeElementAt(framenum, nsnull);
}
imgFrame*
RasterImage::GetImgFrame(PRUint32 framenum)
{
nsresult rv = WantDecodedFrames();
CONTAINER_ENSURE_TRUE(NS_SUCCEEDED(rv), nsnull);
return GetImgFrameNoDecode(framenum);
}
imgFrame*
RasterImage::GetDrawableImgFrame(PRUint32 framenum)
{
@ -979,7 +984,7 @@ RasterImage::FrameUpdated(PRUint32 aFrameNum, nsIntRect &aUpdatedRect)
{
NS_ABORT_IF_FALSE(aFrameNum < mFrames.Length(), "Invalid frame index!");
imgFrame *frame = GetImgFrame(aFrameNum);
imgFrame *frame = GetImgFrameNoDecode(aFrameNum);
NS_ABORT_IF_FALSE(frame, "Calling FrameUpdated on frame that doesn't exist!");
frame->ImageUpdated(aUpdatedRect);

View File

@ -375,6 +375,7 @@ private:
*/
void DeleteImgFrame(PRUint32 framenum);
imgFrame* GetImgFrameNoDecode(PRUint32 framenum);
imgFrame* GetImgFrame(PRUint32 framenum);
imgFrame* GetDrawableImgFrame(PRUint32 framenum);
imgFrame* GetCurrentImgFrame();