aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2006-12-11 09:26:54 +0000
committerTravis Howell2006-12-11 09:26:54 +0000
commit1ba6947440a4e3f98d946ac2a784ea2a4adcc947 (patch)
treef5a80e7fb77446504d8dcfd2bb197128d06885f2
parent983954821c60847c5382aa87df631b1aa135938d (diff)
downloadscummvm-rg350-1ba6947440a4e3f98d946ac2a784ea2a4adcc947.tar.gz
scummvm-rg350-1ba6947440a4e3f98d946ac2a784ea2a4adcc947.tar.bz2
scummvm-rg350-1ba6947440a4e3f98d946ac2a784ea2a4adcc947.zip
Adjust DXA scaling code for Broken Sword 1
svn-id: r24841
-rw-r--r--engines/sword1/animation.cpp4
-rw-r--r--graphics/dxa_player.cpp54
2 files changed, 25 insertions, 33 deletions
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index 9d196d39be..498f185f70 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -348,9 +348,9 @@ void MoviePlayerDXA::processFrame(void) {
}
void MoviePlayerDXA::updateScreen(void) {
- // Using _frameBuffer1 directly should work, as long as we don't do any
+ // Using _scaledBuffer directly should work, as long as we don't do any
// post-processing of the frame.
- _sys->copyRectToScreen(_frameBuffer1, _frameWidth, _frameX, _frameY, _frameWidth, _frameHeight);
+ _sys->copyRectToScreen(_scaledBuffer, _frameWidth, _frameX, _frameY, _frameWidth, _frameHeight);
_sys->updateScreen();
}
diff --git a/graphics/dxa_player.cpp b/graphics/dxa_player.cpp
index dc4ad5551c..b3df046432 100644
--- a/graphics/dxa_player.cpp
+++ b/graphics/dxa_player.cpp
@@ -117,19 +117,14 @@ bool DXAPlayer::loadFile(const char *filename) {
_curHeight = _height;
}
- debug(2, "frames_count %d width %d height %d rate %d ticks %d", _framesCount, _width, _height, _framesPerSec, _frameTicks);
+ debug(2, "flags 0x0%x framesCount %d width %d height %d rate %d ticks %d", flags, _framesCount, _width, _height, _framesPerSec, _frameTicks);
_frameSize = _width * _height;
_frameBuffer1 = (uint8 *)malloc(_frameSize);
_frameBuffer2 = (uint8 *)malloc(_frameSize);
- if (!_frameBuffer1 || !_frameBuffer2)
- error("Error allocating frame buffers (size %d)", _frameSize);
-
- if (_scaleMode != S_NONE) {
- _scaledBuffer = (uint8 *)malloc(_frameSize);
- if (!_scaledBuffer)
- error("Error allocating scale buffer (size %d)", _frameSize);
- }
+ _scaledBuffer = (uint8 *)malloc(_frameSize);
+ if (!_frameBuffer1 || !_frameBuffer2 || !_scaledBuffer)
+ error("DXAPlayer: Error allocating buffers (size %d)", _frameSize);
_frameNum = 0;
_frameSkipped = 0;
@@ -148,30 +143,10 @@ void DXAPlayer::closeFile() {
}
void DXAPlayer::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) {
- byte *src;
-
- switch (_scaleMode) {
- case S_INTERLACED:
- memset(_scaledBuffer, 0, _width * _height);
- for (int cy = 0; cy < _curHeight; cy++)
- memcpy(&_scaledBuffer[2 * cy * _width], &_frameBuffer1[cy * _width], _width);
- src = _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);
- }
- src = _scaledBuffer;
- break;
- case S_NONE:
- src = _frameBuffer1;
- break;
- }
-
uint h = _height;
uint w = _width;
+ byte *src = _scaledBuffer;
dst += y * pitch + x;
do {
@@ -524,13 +499,30 @@ void DXAPlayer::decodeNextFrame() {
if (type == 2 || type == 4 || type == 12 || type == 13) {
memcpy(_frameBuffer1, _frameBuffer2, _frameSize);
} else {
- for (int j = 0; j < _height; ++j) {
+ for (int j = 0; j < _curHeight; ++j) {
for (int i = 0; i < _width; ++i) {
const int offs = j * _width + i;
_frameBuffer1[offs] ^= _frameBuffer2[offs];
}
}
}
+
+ switch (_scaleMode) {
+ case S_INTERLACED:
+ memset(_scaledBuffer, 0, _width * _height);
+ for (int cy = 0; cy < _curHeight; cy++)
+ memcpy(&_scaledBuffer[2 * cy * _width], &_frameBuffer1[cy * _width], _width);
+ 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);
+ }
+ break;
+ case S_NONE:
+ memcpy(_scaledBuffer, _frameBuffer1, _width * _height);
+ break;
+ }
}
}