[Scummvm-cvs-logs] SF.net SVN: scummvm:[39396] scummvm/trunk/engines/made

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat Mar 14 16:43:37 CET 2009


Revision: 39396
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39396&view=rev
Author:   thebluegr
Date:     2009-03-14 15:43:37 +0000 (Sat, 14 Mar 2009)

Log Message:
-----------
Merged loadRGBPalette() inside setRGBPalette() (that's the only place it's used and where the screen palette is set). Added a wrapper for copyRectToScreen(), to remove some duplicated code inside the ScreenEffects() class

Modified Paths:
--------------
    scummvm/trunk/engines/made/screen.cpp
    scummvm/trunk/engines/made/screen.h
    scummvm/trunk/engines/made/screenfx.cpp

Modified: scummvm/trunk/engines/made/screen.cpp
===================================================================
--- scummvm/trunk/engines/made/screen.cpp	2009-03-14 15:34:28 UTC (rev 39395)
+++ scummvm/trunk/engines/made/screen.cpp	2009-03-14 15:43:37 UTC (rev 39396)
@@ -218,17 +218,14 @@
 
 }
 
-void Screen::loadRGBPalette(byte *palRGB, int count) {
+void Screen::setRGBPalette(byte *palRGB, int start, int count) {
 	for (int i = 0; i < count; i++) {
 		_screenPalette[i * 4 + 0] = palRGB[i * 3 + 0];
 		_screenPalette[i * 4 + 1] = palRGB[i * 3 + 1];
 		_screenPalette[i * 4 + 2] = palRGB[i * 3 + 2];
 		_screenPalette[i * 4 + 3] = 0;
 	}
-}
 
-void Screen::setRGBPalette(byte *palRGB, int start, int count) {
-	loadRGBPalette(palRGB, count);
 	_vm->_system->setPalette(_screenPalette, start, count);
 }
 
@@ -803,6 +800,10 @@
 	_vm->_system->copyRectToScreen((const byte*)_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h);
 }
 
+void Screen::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+	_vm->_system->copyRectToScreen(buf, pitch, x, y, w, h);
+}
+
 void Screen::updateScreenAndWait(int delay) {
 	_vm->_system->updateScreen();
 	uint32 startTime = _vm->_system->getMillis();

Modified: scummvm/trunk/engines/made/screen.h
===================================================================
--- scummvm/trunk/engines/made/screen.h	2009-03-14 15:34:28 UTC (rev 39395)
+++ scummvm/trunk/engines/made/screen.h	2009-03-14 15:43:37 UTC (rev 39396)
@@ -91,7 +91,6 @@
 
 	void drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 flipX, int16 flipY, int16 mask, const ClipInfo &clipInfo);
 
-	void loadRGBPalette(byte *palRGB, int count = 256);
 	void setRGBPalette(byte *palRGB, int start = 0, int count = 256);
 	bool isPaletteLocked() { return _paletteLock; }
 	void setPaletteLock(bool lock) { _paletteLock = lock; }
@@ -188,6 +187,7 @@
 	Graphics::Surface *lockScreen();
 	void unlockScreen();
 	void showWorkScreen();
+	void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
 	void updateScreenAndWait(int delay);
 
 	int16 addToSpriteList(int16 index, int16 xofs, int16 yofs);

Modified: scummvm/trunk/engines/made/screenfx.cpp
===================================================================
--- scummvm/trunk/engines/made/screenfx.cpp	2009-03-14 15:34:28 UTC (rev 39395)
+++ scummvm/trunk/engines/made/screenfx.cpp	2009-03-14 15:43:37 UTC (rev 39396)
@@ -268,15 +268,7 @@
 	if (xd == -1) xd = x1;
 	if (yd == -1) yd = y1;
 
-	Graphics::Surface *vgaScreen = _screen->lockScreen();
-	byte *source = (byte*)surface->getBasePtr(x1, y1);
-	byte *dest = (byte*)vgaScreen->getBasePtr(xd, yd);
-	for (int y = 0; y < y2 - y1; y++) {
-		memcpy(dest, source, x2 - x1);
-		dest += 320;
-		source += 320;
-	}
-	_screen->unlockScreen();
+	_screen->copyRectToScreen((const byte*)surface->pixels, surface->pitch, xd, yd, surface->w, surface->h);
 }
 
 void ScreenEffects::reposition(int16 x1, int16 y1, int16 x2, int16 y2, int xd, int yd) {


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