aboutsummaryrefslogtreecommitdiff
path: root/engines/lab/anim.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2015-12-24 16:15:55 +0100
committerWillem Jan Palenstijn2015-12-24 16:16:48 +0100
commitdacbf9881c72177369e4dde250bc6e9a907f7b00 (patch)
tree28ac678fd7a1f9171829888f7d71c5442924805f /engines/lab/anim.cpp
parent442c1538a21e5826b167aed52ec8d95cba65db64 (diff)
downloadscummvm-rg350-dacbf9881c72177369e4dde250bc6e9a907f7b00.tar.gz
scummvm-rg350-dacbf9881c72177369e4dde250bc6e9a907f7b00.tar.bz2
scummvm-rg350-dacbf9881c72177369e4dde250bc6e9a907f7b00.zip
LAB: Make _dispBitmap handling more explicit
Diffstat (limited to 'engines/lab/anim.cpp')
-rw-r--r--engines/lab/anim.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp
index 9507e0a907..7f7e488e9e 100644
--- a/engines/lab/anim.cpp
+++ b/engines/lab/anim.cpp
@@ -80,17 +80,24 @@ void Anim::diffNextFrame(bool onlyDiffData) {
return;
BitMap *disp = _vm->_graphics->_dispBitMap;
- if (disp->_drawOnScreen)
- disp->_buffer = _vm->_graphics->getCurrentDrawingBuffer();
-
- byte *endOfBuf = disp->_buffer + (int)_diffWidth * _diffHeight;
+ bool drawOnScreen = disp->_drawOnScreen;
+ byte *startOfBuf = disp->_buffer;
+ int bufPitch = disp->_bytesPerRow;
+
+ if (drawOnScreen) {
+ startOfBuf = _vm->_graphics->getCurrentDrawingBuffer();
+ bufPitch = _vm->_graphics->_screenWidth;
+ } else {
+ assert(startOfBuf);
+ }
+ byte *endOfBuf = startOfBuf + (int)_diffWidth * _diffHeight;
_vm->_event->mouseHide();
int curBit = 0;
while (1) {
- byte *buf = disp->_buffer + 0x10000 * curBit;
+ byte *buf = startOfBuf + 0x10000 * curBit;
if (buf >= endOfBuf) {
_vm->_event->mouseShow();
@@ -124,7 +131,7 @@ void Anim::diffNextFrame(bool onlyDiffData) {
_isAnim = (_frameNum >= 3) && (!_playOnce);
- if (disp->_drawOnScreen)
+ if (drawOnScreen)
_vm->_graphics->screenUpdate();
// done with the next frame.
@@ -167,21 +174,21 @@ void Anim::diffNextFrame(bool onlyDiffData) {
case 12:
curPos = _diffFile->pos();
_diffFile->skip(4);
- _vm->_utils->verticalRunLengthDecode(buf, _diffFile, disp->_bytesPerRow);
+ _vm->_utils->verticalRunLengthDecode(buf, _diffFile, bufPitch);
curBit++;
_diffFile->seek(curPos + _size, SEEK_SET);
break;
case 20:
curPos = _diffFile->pos();
- _vm->_utils->unDiff(buf, buf, _diffFile, disp->_bytesPerRow, false);
+ _vm->_utils->unDiff(buf, buf, _diffFile, bufPitch, false);
curBit++;
_diffFile->seek(curPos + _size, SEEK_SET);
break;
case 21:
curPos = _diffFile->pos();
- _vm->_utils->unDiff(buf, buf, _diffFile, disp->_bytesPerRow, true);
+ _vm->_utils->unDiff(buf, buf, _diffFile, bufPitch, true);
curBit++;
_diffFile->seek(curPos + _size, SEEK_SET);
break;
@@ -218,7 +225,7 @@ void Anim::diffNextFrame(bool onlyDiffData) {
_vm->updateMusicAndEvents();
_vm->waitTOF();
- if (disp->_drawOnScreen)
+ if (drawOnScreen)
didTOF = true;
}
}