From 229f4504272a8e94ad9d718105b9d7ece8145a97 Mon Sep 17 00:00:00 2001 From: Andrew Osmond Date: Mon, 19 Nov 2018 21:05:54 -0500 Subject: [PATCH] Bug 1508393 - Enable animated images producing full frames by default. r=tnikkel Also, fix a minor bug where when we discard an animated image that is a full frame animated image, we need to reset AnimationState::mCompositedFrameInvalid to false, just like we do for animated images blended by FrameAnimator. This is because it is used as part of our state checking in FrameAnimator::GetCompositedFrame before we are willing to yield frame data. Differential Revision: https://phabricator.services.mozilla.com/D12362 --- image/FrameAnimator.cpp | 11 ++++++++--- modules/libpref/init/all.js | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/image/FrameAnimator.cpp b/image/FrameAnimator.cpp index 8bd280f7029b..c09bd54193b1 100644 --- a/image/FrameAnimator.cpp +++ b/image/FrameAnimator.cpp @@ -496,10 +496,15 @@ FrameAnimator::RequestRefresh(AnimationState& aState, // We should only mark the composited frame as valid and reset the dirty rect // if we advanced (meaning the next frame was actually produced somehow), the // composited frame was previously invalid (so we may need to repaint - // everything) and the frame index is valid (to know we were doing blending - // on the main thread, instead of on the decoder threads in advance). + // everything) and either the frame index is valid (to know we were doing + // blending on the main thread, instead of on the decoder threads in advance), + // or the current frame is a full frame (blends off the main thread). + // + // If for some reason we forget to reset aState.mCompositedFrameInvalid, then + // GetCompositedFrame will fail, even if we have all the data available for + // display. if (currentFrameEndTime > aTime && aState.mCompositedFrameInvalid && - mLastCompositedFrameIndex >= 0) { + (mLastCompositedFrameIndex >= 0 || currentFrame->IsFullFrame())) { aState.mCompositedFrameInvalid = false; ret.mDirtyRect = IntRect(IntPoint(0,0), mSize); } diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 424831260552..9bc31086fffe 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4686,7 +4686,7 @@ pref("image.animated.decode-on-demand.recycle", true); // Whether we should generate full frames at decode time or partial frames which // are combined at display time (historical behavior and default). -pref("image.animated.generate-full-frames", false); +pref("image.animated.generate-full-frames", true); // Resume an animated image from the last displayed frame rather than // advancing when out of view.