diff options
author | richiesams | 2013-08-28 09:15:51 -0500 |
---|---|---|
committer | richiesams | 2013-08-28 16:44:39 -0500 |
commit | a1a70170d4a28a426fe916225a2aa9adbdcf5f95 (patch) | |
tree | 984955d4d8bc0b458061fd8b715a901f9a891a02 | |
parent | 945982c8577b9c8a34333898841b5ffcfaa7138b (diff) | |
download | scummvm-rg350-a1a70170d4a28a426fe916225a2aa9adbdcf5f95.tar.gz scummvm-rg350-a1a70170d4a28a426fe916225a2aa9adbdcf5f95.tar.bz2 scummvm-rg350-a1a70170d4a28a426fe916225a2aa9adbdcf5f95.zip |
ZVISION: Remove RlfAnimation::getPreviousFrame()
I realized that RlfAnimations don't use B-frames, therefore, can not easily go backwards.
-rw-r--r-- | engines/zvision/rlf_animation.cpp | 30 | ||||
-rw-r--r-- | engines/zvision/rlf_animation.h | 2 |
2 files changed, 6 insertions, 26 deletions
diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 77c1a50266..90b39dc757 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -158,34 +158,25 @@ const uint16 *RlfAnimation::getFrameData(uint frameNumber) { assert(frameNumber < _frameCount); // Since this method is so expensive, first check to see if we can use - // getNextFrame() or getPreviousFrame() since they are cheap. + // getNextFrame() it's cheap. if ((int)frameNumber == _currentFrame) { return _currentFrameBuffer; } else if (_currentFrame + 1 == (int)frameNumber) { return getNextFrame(); - } else if (_currentFrame - 1 == (int)frameNumber) { - return getPreviousFrame(); } int closestFrame = _currentFrame; - int distance = ABS(_currentFrame - (int)frameNumber); + int distance = (int)frameNumber - _currentFrame; for (Common::List<uint>::const_iterator iter = _completeFrames.begin(); iter != _completeFrames.end(); iter++) { - int newDistance = ABS((int)(*iter) - (int)frameNumber); - if (closestFrame == -1 || newDistance < distance) { + int newDistance = (int)frameNumber - (int)(*iter); + if (newDistance > 0 && (closestFrame == -1 || newDistance < distance)) { closestFrame = (*iter); distance = newDistance; } } - bool forwards = (int)frameNumber > closestFrame; - if (forwards) { - for (uint i = closestFrame; i <= frameNumber; i++) { - applyFrameToCurrent(i); - } - } else { - for (uint i = closestFrame; i >= frameNumber; i--) { - applyFrameToCurrent(i); - } + for (uint i = closestFrame; i <= frameNumber; i++) { + applyFrameToCurrent(i); } _currentFrame = frameNumber; @@ -205,15 +196,6 @@ const uint16 *RlfAnimation::getNextFrame() { return _currentFrameBuffer; } -const uint16 *RlfAnimation::getPreviousFrame() { - assert(!_stream); - assert(_currentFrame - 1 >= 0); - - applyFrameToCurrent(_currentFrame - 1); - _currentFrame--; - return _currentFrameBuffer; -} - void RlfAnimation::applyFrameToCurrent(uint frameNumber) { if (_frames[frameNumber].type == Masked) { decodeMaskedRunLengthEncoding(_frames[frameNumber].encodedData, (int8 *)_currentFrameBuffer, _frames[frameNumber].encodedSize, _frameBufferByteSize); diff --git a/engines/zvision/rlf_animation.h b/engines/zvision/rlf_animation.h index d49e6a9395..5091185a36 100644 --- a/engines/zvision/rlf_animation.h +++ b/engines/zvision/rlf_animation.h @@ -74,9 +74,7 @@ public: uint32 frameTime() { return _frameTime; } const uint16 *getFrameData(uint frameNumber); - const uint16 *getNextFrame(); - const uint16 *getPreviousFrame(); bool endOfAnimation() { return _currentFrame == (int)_frameCount - 1; } |