aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-12-14 05:21:19 +0000
committerTorbjörn Andersson2006-12-14 05:21:19 +0000
commit45886ec8ed7ef2244523b05e10a852d9851d772d (patch)
treea9c85c71e486ae3a558260389c18ceec17166f15
parent42228fdc361b7c68d6326c2a89131b3bda966a90 (diff)
downloadscummvm-rg350-45886ec8ed7ef2244523b05e10a852d9851d772d.tar.gz
scummvm-rg350-45886ec8ed7ef2244523b05e10a852d9851d772d.tar.bz2
scummvm-rg350-45886ec8ed7ef2244523b05e10a852d9851d772d.zip
When drawing an interlaced frame, only clear every other line instead of the
entire buffer. Introduced a _drawBuffer pointer which points either to _scaledBuffer or _frameBuffer1. That way, we don't need to copy _frameBuffer1 every time we draw an unscaled frame. (Probably the most common case by far.) Adjusted the Broken Sword 1 DXA player for the second change. (It sneakily avoids copying each frame by using _drawBuffer directly.) svn-id: r24846
-rw-r--r--engines/sword1/animation.cpp4
-rw-r--r--graphics/dxa_player.cpp12
-rw-r--r--graphics/dxa_player.h1
3 files changed, 11 insertions, 6 deletions
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index 498f185f70..afe9a13bd1 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -348,9 +348,9 @@ void MoviePlayerDXA::processFrame(void) {
}
void MoviePlayerDXA::updateScreen(void) {
- // Using _scaledBuffer directly should work, as long as we don't do any
+ // Using _drawBuffer directly should work, as long as we don't do any
// post-processing of the frame.
- _sys->copyRectToScreen(_scaledBuffer, _frameWidth, _frameX, _frameY, _frameWidth, _frameHeight);
+ _sys->copyRectToScreen(_drawBuffer, _frameWidth, _frameX, _frameY, _frameWidth, _frameHeight);
_sys->updateScreen();
}
diff --git a/graphics/dxa_player.cpp b/graphics/dxa_player.cpp
index d4e216d27d..157b5ef24e 100644
--- a/graphics/dxa_player.cpp
+++ b/graphics/dxa_player.cpp
@@ -35,6 +35,7 @@ DXAPlayer::DXAPlayer() {
_frameBuffer1 = 0;
_frameBuffer2 = 0;
_scaledBuffer = 0;
+ _drawBuffer = 0;
_width = 0;
_height = 0;
@@ -146,7 +147,7 @@ void DXAPlayer::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) {
uint h = _height;
uint w = _width;
- byte *src = _scaledBuffer;
+ byte *src = _drawBuffer;
dst += y * pitch + x;
do {
@@ -510,18 +511,21 @@ void DXAPlayer::decodeNextFrame() {
switch (_scaleMode) {
case S_INTERLACED:
- memset(_scaledBuffer, 0, _width * _height);
- for (int cy = 0; cy < _curHeight; cy++)
+ for (int cy = 0; cy < _curHeight; cy++) {
memcpy(&_scaledBuffer[2 * cy * _width], &_frameBuffer1[cy * _width], _width);
+ memset(&_scaledBuffer[((2 * cy) + 1) * _width], 0, _width);
+ }
+ _drawBuffer = _scaledBuffer;
break;
case S_DOUBLE:
for (int cy = 0; cy < _curHeight; cy++) {
memcpy(&_scaledBuffer[2 * cy * _width], &_frameBuffer1[cy * _width], _width);
memcpy(&_scaledBuffer[((2 * cy) + 1) * _width], &_frameBuffer1[cy * _width], _width);
}
+ _drawBuffer = _scaledBuffer;
break;
case S_NONE:
- memcpy(_scaledBuffer, _frameBuffer1, _width * _height);
+ _drawBuffer = _frameBuffer1;
break;
}
}
diff --git a/graphics/dxa_player.h b/graphics/dxa_player.h
index 09cfb021a9..a6e751c8a3 100644
--- a/graphics/dxa_player.h
+++ b/graphics/dxa_player.h
@@ -45,6 +45,7 @@ protected:
byte *_frameBuffer1;
byte *_frameBuffer2;
byte *_scaledBuffer;
+ byte *_drawBuffer;
uint16 _width;
uint16 _height, _curHeight;
uint16 _framesCount;