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

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Thu Dec 14 06:21:26 CET 2006


Revision: 24846
          http://scummvm.svn.sourceforge.net/scummvm/?rev=24846&view=rev
Author:   eriktorbjorn
Date:     2006-12-13 21:21:19 -0800 (Wed, 13 Dec 2006)

Log Message:
-----------
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.)

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

Modified: scummvm/trunk/engines/sword1/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword1/animation.cpp	2006-12-11 22:52:34 UTC (rev 24845)
+++ scummvm/trunk/engines/sword1/animation.cpp	2006-12-14 05:21:19 UTC (rev 24846)
@@ -348,9 +348,9 @@
 }
 
 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();
 }
 

Modified: scummvm/trunk/graphics/dxa_player.cpp
===================================================================
--- scummvm/trunk/graphics/dxa_player.cpp	2006-12-11 22:52:34 UTC (rev 24845)
+++ scummvm/trunk/graphics/dxa_player.cpp	2006-12-14 05:21:19 UTC (rev 24846)
@@ -35,6 +35,7 @@
 	_frameBuffer1 = 0;
 	_frameBuffer2 = 0;
 	_scaledBuffer = 0;
+	_drawBuffer = 0;
 
 	_width = 0;
 	_height = 0;
@@ -146,7 +147,7 @@
 	uint h = _height;
 	uint w = _width;
 
-	byte *src = _scaledBuffer;
+	byte *src = _drawBuffer;
 	dst += y * pitch + x;
 
 	do {
@@ -510,18 +511,21 @@
 
 		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;
 		}
 	}

Modified: scummvm/trunk/graphics/dxa_player.h
===================================================================
--- scummvm/trunk/graphics/dxa_player.h	2006-12-11 22:52:34 UTC (rev 24845)
+++ scummvm/trunk/graphics/dxa_player.h	2006-12-14 05:21:19 UTC (rev 24846)
@@ -45,6 +45,7 @@
 	byte *_frameBuffer1;
 	byte *_frameBuffer2;
 	byte *_scaledBuffer;
+	byte *_drawBuffer;
 	uint16 _width;
 	uint16 _height, _curHeight;
 	uint16 _framesCount;


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