diff options
author | richiesams | 2013-08-24 00:16:59 -0500 |
---|---|---|
committer | richiesams | 2013-08-24 00:23:43 -0500 |
commit | d2df3eb24ea68eec5538fac73829b168f747e7a6 (patch) | |
tree | df0fb0ab5318fa1c8a621e06fd9a43bb63b1ba3b /engines/zvision | |
parent | c6242e71344d260af49cf5b2368a16d8679aac45 (diff) | |
download | scummvm-rg350-d2df3eb24ea68eec5538fac73829b168f747e7a6.tar.gz scummvm-rg350-d2df3eb24ea68eec5538fac73829b168f747e7a6.tar.bz2 scummvm-rg350-d2df3eb24ea68eec5538fac73829b168f747e7a6.zip |
ZVISION: Check if we can use getNextFrame() or getPreviousFrame() before using getFrameData()
Diffstat (limited to 'engines/zvision')
-rw-r--r-- | engines/zvision/rlf_animation.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/engines/zvision/rlf_animation.cpp b/engines/zvision/rlf_animation.cpp index 52ca96f0e1..5c0a88a18f 100644 --- a/engines/zvision/rlf_animation.cpp +++ b/engines/zvision/rlf_animation.cpp @@ -157,8 +157,14 @@ const uint16 *RlfAnimation::getFrameData(uint frameNumber) { assert(!_stream); assert(frameNumber < _frameCount && frameNumber >= 0); + // Since this method is so expensive, first check to see if we can use + // getNextFrame() or getPreviousFrame() since they are cheap. if (frameNumber == _currentFrame) { return _currentFrameBuffer; + } else if (_currentFrame + 1 == frameNumber) { + return getNextFrame(); + } else if (_currentFrame - 1 == frameNumber) { + return getPreviousFrame(); } uint closestFrame = _currentFrame; |