Bug 924366 - Animated GIFs shouldn't loop before they have finished decoding. r=seth, a=lsblakk
authorBill McCloskey <wmccloskey@mozilla.com>
Thu, 12 Dec 2013 14:17:41 -0800
changeset 175321 2c962cec8c3c1565112e6954a63315aa5d29e050
parent 175320 3b3c685fdc33143436cf31950d4c0e2a4a09afab
child 175322 9b6627823cf117f1663eb7174006d449ab1a8cf2
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersseth, lsblakk
bugs924366
milestone28.0a2
Bug 924366 - Animated GIFs shouldn't loop before they have finished decoding. r=seth, a=lsblakk
image/src/FrameAnimator.cpp
--- a/image/src/FrameAnimator.cpp
+++ b/image/src/FrameAnimator.cpp
@@ -84,21 +84,21 @@ FrameAnimator::AdvanceFrame(TimeStamp aT
   uint32_t nextFrameIndex = currentFrameIndex + 1;
   uint32_t timeout = 0;
 
   RefreshResult ret;
 
   // If we're done decoding, we know we've got everything we're going to get.
   // If we aren't, we only display fully-downloaded frames; everything else
   // gets delayed.
-  bool needToWait = !mDoneDecoding &&
-                    mFrameBlender.RawGetFrame(nextFrameIndex) &&
-                    !mFrameBlender.RawGetFrame(nextFrameIndex)->ImageComplete();
+  bool canDisplay = mDoneDecoding ||
+                    (mFrameBlender.RawGetFrame(nextFrameIndex) &&
+                     mFrameBlender.RawGetFrame(nextFrameIndex)->ImageComplete());
 
-  if (needToWait) {
+  if (!canDisplay) {
     // Uh oh, the frame we want to show is currently being decoded (partial)
     // Wait until the next refresh driver tick and try again
     return ret;
   } else {
     // If we're done decoding the next frame, go ahead and display it now and
     // reinit with the next frame's delay time.
     if (mFrameBlender.GetNumFrames() == nextFrameIndex) {
       // End of Animation, unless we are looping forever