aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorrichiesams2013-08-24 00:16:59 -0500
committerrichiesams2013-08-24 00:23:43 -0500
commitd2df3eb24ea68eec5538fac73829b168f747e7a6 (patch)
treedf0fb0ab5318fa1c8a621e06fd9a43bb63b1ba3b /engines
parentc6242e71344d260af49cf5b2368a16d8679aac45 (diff)
downloadscummvm-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')
-rw-r--r--engines/zvision/rlf_animation.cpp6
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;