mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1288040 (Part 7) - Make FrameAnimator::GetTimeoutForFrame() a private method that doesn't rely on AnimationState. r=edwin
This commit is contained in:
parent
aa9b084d09
commit
930f26424f
@ -94,7 +94,7 @@ FrameAnimator::GetSingleLoopTime(AnimationState& aState) const
|
||||
|
||||
int32_t looptime = 0;
|
||||
for (uint32_t i = 0; i < mImage->GetNumFrames(); ++i) {
|
||||
FrameTimeout timeout = GetTimeoutForFrame(aState, i);
|
||||
FrameTimeout timeout = GetTimeoutForFrame(i);
|
||||
if (timeout == FrameTimeout::Forever()) {
|
||||
// If we have a frame that never times out, we're probably in an error
|
||||
// case, but let's handle it more gracefully.
|
||||
@ -112,8 +112,7 @@ TimeStamp
|
||||
FrameAnimator::GetCurrentImgFrameEndTime(AnimationState& aState) const
|
||||
{
|
||||
TimeStamp currentFrameTime = aState.mCurrentAnimationFrameTime;
|
||||
FrameTimeout timeout =
|
||||
GetTimeoutForFrame(aState, aState.mCurrentAnimationFrameIndex);
|
||||
FrameTimeout timeout = GetTimeoutForFrame(aState.mCurrentAnimationFrameIndex);
|
||||
|
||||
if (timeout == FrameTimeout::Forever()) {
|
||||
// We need to return a sentinel value in this case, because our logic
|
||||
@ -210,7 +209,7 @@ FrameAnimator::AdvanceFrame(AnimationState& aState, TimeStamp aTime)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (GetTimeoutForFrame(aState, nextFrameIndex) == FrameTimeout::Forever()) {
|
||||
if (GetTimeoutForFrame(nextFrameIndex) == FrameTimeout::Forever()) {
|
||||
ret.animationFinished = true;
|
||||
}
|
||||
|
||||
@ -317,7 +316,7 @@ FrameAnimator::GetCompositedFrame(uint32_t aFrameNum)
|
||||
}
|
||||
|
||||
FrameTimeout
|
||||
FrameAnimator::GetTimeoutForFrame(AnimationState& aState, uint32_t aFrameNum) const
|
||||
FrameAnimator::GetTimeoutForFrame(uint32_t aFrameNum) const
|
||||
{
|
||||
RawAccessFrameRef frame = GetRawFrame(aFrameNum);
|
||||
if (frame) {
|
||||
@ -325,10 +324,6 @@ FrameAnimator::GetTimeoutForFrame(AnimationState& aState, uint32_t aFrameNum) co
|
||||
return data.mTimeout;
|
||||
}
|
||||
|
||||
if (aFrameNum == 0) {
|
||||
return aState.mFirstFrameTimeout;
|
||||
}
|
||||
|
||||
NS_WARNING("No frame; called GetTimeoutForFrame too early?");
|
||||
return FrameTimeout::FromRawMilliseconds(100);
|
||||
}
|
||||
|
@ -182,9 +182,6 @@ public:
|
||||
*/
|
||||
LookupResult GetCompositedFrame(uint32_t aFrameNum);
|
||||
|
||||
/// @return the given frame's timeout.
|
||||
FrameTimeout GetTimeoutForFrame(AnimationState& aState, uint32_t aFrameNum) const;
|
||||
|
||||
/**
|
||||
* Collect an accounting of the memory occupied by the compositing surfaces we
|
||||
* use during animation playback. All of the actual animation frames are
|
||||
@ -222,6 +219,9 @@ private: // methods
|
||||
*/
|
||||
int32_t GetSingleLoopTime(AnimationState& aState) const;
|
||||
|
||||
/// @return the given frame's timeout.
|
||||
FrameTimeout GetTimeoutForFrame(uint32_t aFrameNum) const;
|
||||
|
||||
/**
|
||||
* Get the time the frame we're currently displaying is supposed to end.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user