forked from mirrors/gecko-dev
Bug 1676988. Use GetFrame instead of Seek in AnimationState::UpdateStateInternal. r=aosmond
In https://hg.mozilla.org/integration/autoland/rev/471ad96ddc3e we changed this from calling |Surface().IsFullyDecoded()| to calling Seek because IsFullyDecoded always returns false for large enough animations because we don't keep around all of their frames. However RequestRefresh/AdvanceFrame call GetFrame. Seek is intended to be used for display purposes, GetFrame is intended to be used for advancing the frame purposes. And Seek and GetFrame can actually returns different results if it is the first frame that we are asking for. Differential Revision: https://phabricator.services.mozilla.com/D96944
This commit is contained in:
parent
fa092143ff
commit
6ab48a8579
1 changed files with 14 additions and 3 deletions
|
|
@ -54,9 +54,20 @@ const gfx::IntRect AnimationState::UpdateStateInternal(
|
|||
|
||||
// If we can seek to the current animation frame we consider it decoded.
|
||||
// Animated images are never fully decoded unless very short.
|
||||
mIsCurrentlyDecoded =
|
||||
bool(aResult.Surface()) &&
|
||||
NS_SUCCEEDED(aResult.Surface().Seek(mCurrentAnimationFrameIndex));
|
||||
// Note that we use GetFrame instead of Seek here. The difference is that
|
||||
// Seek eventually calls AnimationFrameBuffer::Get with aForDisplay == true,
|
||||
// whereas GetFrame calls AnimationFrameBuffer::Get with aForDisplay ==
|
||||
// false. The aForDisplay can change whether those functions succeed or not
|
||||
// (only for the first frame). Since this is not for display we want to pass
|
||||
// aForDisplay == false, but also for consistency with
|
||||
// RequestRefresh/AdvanceFrame, because we want our state to be in sync with
|
||||
// those functions. The user of Seek (GetCompositedFrame) doesn't need to be
|
||||
// in sync with our state.
|
||||
RefPtr<imgFrame> currentFrame =
|
||||
bool(aResult.Surface())
|
||||
? aResult.Surface().GetFrame(mCurrentAnimationFrameIndex)
|
||||
: nullptr;
|
||||
mIsCurrentlyDecoded = !!currentFrame;
|
||||
}
|
||||
|
||||
gfx::IntRect ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue