[Scummvm-cvs-logs] SF.net SVN: scummvm:[54624] scummvm/trunk/engines/mohawk

bgk at users.sourceforge.net bgk at users.sourceforge.net
Mon Nov 29 21:57:41 CET 2010


Revision: 54624
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54624&view=rev
Author:   bgk
Date:     2010-11-29 20:57:41 +0000 (Mon, 29 Nov 2010)

Log Message:
-----------
Revert "MOHAWK: Revert the screen cache since it has a huge performance hit, and is not needed as is."

This reverts commit 7d19efd9b3868a23a7e9924bfe43bba7f7617534.

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/graphics.cpp
    scummvm/trunk/engines/mohawk/graphics.h

Modified: scummvm/trunk/engines/mohawk/graphics.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/graphics.cpp	2010-11-29 20:57:27 UTC (rev 54623)
+++ scummvm/trunk/engines/mohawk/graphics.cpp	2010-11-29 20:57:41 UTC (rev 54624)
@@ -138,6 +138,9 @@
 
 	_pictureFile.entries = NULL;
 
+	// Initialize our buffer
+	_mainScreen = new Graphics::Surface();
+	_mainScreen->create(_vm->_system->getWidth(), _vm->_system->getHeight(), _pixelFormat.bytesPerPixel);
 	_dirtyScreen = false;
 }
 
@@ -146,6 +149,9 @@
 	delete _jpegDecoder;
 	delete _pictDecoder;
 	delete[] _pictureFile.entries;
+
+	_mainScreen->free();
+	delete _mainScreen;
 }
 
 static const char* picFileNames[] = {
@@ -267,9 +273,9 @@
 
 	// Convert from bitmap coordinates to surface coordinates
 	uint16 top = surface->h - src.top - height;
-	
-	_vm->_system->copyRectToScreen((byte *)surface->getBasePtr(src.left, top), surface->pitch, dest.left, dest.top, width, height);
 
+	for (uint16 i = 0; i < height; i++)
+		memcpy(_mainScreen->getBasePtr(dest.left, i + dest.top), surface->getBasePtr(src.left, top + i), width * surface->bytesPerPixel);
 
 	// Mark the screen as dirty
 	_dirtyScreen = true;
@@ -282,6 +288,7 @@
 void MystGraphics::updateScreen() {
 	if (_dirtyScreen) {
 		// Only copy the buffer to the screen if it's dirty
+		_vm->_system->copyRectToScreen((byte *)_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
 		_vm->_system->updateScreen();
 		_dirtyScreen = false;
 	}

Modified: scummvm/trunk/engines/mohawk/graphics.h
===================================================================
--- scummvm/trunk/engines/mohawk/graphics.h	2010-11-29 20:57:27 UTC (rev 54623)
+++ scummvm/trunk/engines/mohawk/graphics.h	2010-11-29 20:57:41 UTC (rev 54624)
@@ -130,6 +130,7 @@
 		Common::File picFile;
 	} _pictureFile;
 
+	Graphics::Surface *_mainScreen;
 	bool _dirtyScreen;
 	Graphics::PixelFormat _pixelFormat;
 };


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