[Scummvm-cvs-logs] SF.net SVN: scummvm: [24841] scummvm/trunk

kirben at users.sourceforge.net kirben at users.sourceforge.net
Mon Dec 11 10:27:04 CET 2006


Revision: 24841
          http://scummvm.svn.sourceforge.net/scummvm/?rev=24841&view=rev
Author:   kirben
Date:     2006-12-11 01:26:54 -0800 (Mon, 11 Dec 2006)

Log Message:
-----------
Adjust DXA scaling code for Broken Sword 1

Modified Paths:
--------------
    scummvm/trunk/engines/sword1/animation.cpp
    scummvm/trunk/graphics/dxa_player.cpp

Modified: scummvm/trunk/engines/sword1/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword1/animation.cpp	2006-12-11 08:31:32 UTC (rev 24840)
+++ scummvm/trunk/engines/sword1/animation.cpp	2006-12-11 09:26:54 UTC (rev 24841)
@@ -348,9 +348,9 @@
 }
 
 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();
 }
 

Modified: scummvm/trunk/graphics/dxa_player.cpp
===================================================================
--- scummvm/trunk/graphics/dxa_player.cpp	2006-12-11 08:31:32 UTC (rev 24840)
+++ scummvm/trunk/graphics/dxa_player.cpp	2006-12-11 09:26:54 UTC (rev 24841)
@@ -117,20 +117,15 @@
 		_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);
+	_scaledBuffer = (uint8 *)malloc(_frameSize);
+	if (!_frameBuffer1 || !_frameBuffer2 || !_scaledBuffer)
+		error("DXAPlayer: Error allocating buffers (size %d)", _frameSize);
 
-	if (_scaleMode != S_NONE) {
-		_scaledBuffer = (uint8 *)malloc(_frameSize);
-		if (!_scaledBuffer)
-			error("Error allocating scale buffer (size %d)", _frameSize);
-	}
-
 	_frameNum = 0;
 	_frameSkipped = 0;
 
@@ -148,30 +143,10 @@
 }
 
 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 @@
 		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;
+		}
 	}
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list