Bug 876332 - Set currentAnimationFrameTime correctly based on the current frame's timeout (not the next frame's timeout). r=jrmuizel

In AdvanceFrame(), timeout refers to the timeout of the *next* frame. Setting
the *current* animation frame time based on the *next* frame is nonsense, but
worked for images with uniform frame timings. Unfortunately some images
don't have uniform frame timings!
This commit is contained in:
Joe Drew 2013-05-30 10:31:54 -04:00
parent 74fe8b1dde
commit 3f2ad154cb

View File

@ -616,19 +616,18 @@ RasterImage::AdvanceFrame(TimeStamp aTime, nsIntRect* aDirtyRect)
// something went wrong, move on to next // something went wrong, move on to next
NS_WARNING("RasterImage::AdvanceFrame(): Compositing of frame failed"); NS_WARNING("RasterImage::AdvanceFrame(): Compositing of frame failed");
nextFrame->SetCompositingFailed(true); nextFrame->SetCompositingFailed(true);
mAnim->currentAnimationFrameTime = GetCurrentImgFrameEndTime();
mAnim->currentAnimationFrameIndex = nextFrameIndex; mAnim->currentAnimationFrameIndex = nextFrameIndex;
mAnim->currentAnimationFrameTime = mAnim->currentAnimationFrameTime +
TimeDuration::FromMilliseconds(timeout);
return false; return false;
} }
nextFrame->SetCompositingFailed(false); nextFrame->SetCompositingFailed(false);
} }
mAnim->currentAnimationFrameTime = GetCurrentImgFrameEndTime();
// Set currentAnimationFrameIndex at the last possible moment // Set currentAnimationFrameIndex at the last possible moment
mAnim->currentAnimationFrameIndex = nextFrameIndex; mAnim->currentAnimationFrameIndex = nextFrameIndex;
mAnim->currentAnimationFrameTime = mAnim->currentAnimationFrameTime +
TimeDuration::FromMilliseconds(timeout);
return true; return true;
} }