[Scummvm-cvs-logs] SF.net SVN: scummvm:[41909] scummvm/branches/gsoc2009-16bit

upthorn at users.sourceforge.net upthorn at users.sourceforge.net
Sat Jun 27 07:58:44 CEST 2009


Revision: 41909
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41909&view=rev
Author:   upthorn
Date:     2009-06-27 05:58:44 +0000 (Sat, 27 Jun 2009)

Log Message:
-----------
changed initGraphics, and OSystem::initSize to take Graphics::PixelFormat * parameters instead of Graphics::PixelFormat parameters, to save unnecessary pixelformat initialization if ENABLE_RGB_COLOR is not set.

Modified Paths:
--------------
    scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp
    scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h
    scummvm/branches/gsoc2009-16bit/common/system.h
    scummvm/branches/gsoc2009-16bit/engines/engine.cpp
    scummvm/branches/gsoc2009-16bit/engines/engine.h
    scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp
    scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp

Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp	2009-06-27 05:10:24 UTC (rev 41908)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp	2009-06-27 05:58:44 UTC (rev 41909)
@@ -354,18 +354,21 @@
 	return _videoMode.mode;
 }
 
-void OSystem_SDL::initSize(uint w, uint h, Graphics::PixelFormat format) {
+void OSystem_SDL::initSize(uint w, uint h, Graphics::PixelFormat *format) {
 	assert(_transactionMode == kTransactionActive);
 
 #ifdef ENABLE_RGB_COLOR
 	//avoid redundant format changes
-	assert(format.bytesPerPixel > 0);
+	if (!format)
+		format = new Graphics::PixelFormat(1,8,8,8,8,0,0,0,0);
 
-	if (format != _videoMode.format)
+	assert(format->bytesPerPixel > 0);
+
+	if (*format != _videoMode.format)
 	{
-		_videoMode.format = format;
+		_videoMode.format = *format;
 		_transactionDetails.formatChanged = true;
-		_screenFormat = format;
+		_screenFormat = *format;
 	}
 #endif
 

Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h	2009-06-27 05:10:24 UTC (rev 41908)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h	2009-06-27 05:58:44 UTC (rev 41909)
@@ -123,7 +123,7 @@
 
 	// Set the size and format of the video bitmap.
 	// Typically, 320x200 CLUT8
-	virtual void initSize(uint w, uint h, Graphics::PixelFormat format); // overloaded by CE backend
+	virtual void initSize(uint w, uint h, Graphics::PixelFormat *format); // overloaded by CE backend
 
 	virtual int getScreenChangeID() const { return _screenChangeCount; }
 

Modified: scummvm/branches/gsoc2009-16bit/common/system.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/common/system.h	2009-06-27 05:10:24 UTC (rev 41908)
+++ scummvm/branches/gsoc2009-16bit/common/system.h	2009-06-27 05:58:44 UTC (rev 41909)
@@ -401,7 +401,7 @@
 	 * @param height	the new virtual screen height
 	 * @param format	the new virtual screen pixel format
 	 */
-	virtual void initSize(uint width, uint height, Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8()) = 0;
+	virtual void initSize(uint width, uint height, Graphics::PixelFormat *format = NULL) = 0;
 
 	/**
 	 * Return an int value which is changed whenever any screen

Modified: scummvm/branches/gsoc2009-16bit/engines/engine.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/engine.cpp	2009-06-27 05:10:24 UTC (rev 41908)
+++ scummvm/branches/gsoc2009-16bit/engines/engine.cpp	2009-06-27 05:58:44 UTC (rev 41909)
@@ -124,12 +124,7 @@
 	if (gameDomain && gameDomain->contains("fullscreen"))
 		g_system->setFeatureState(OSystem::kFeatureFullscreenMode, ConfMan.getBool("fullscreen"));
 }
-void initGraphics(int width, int height, bool defaultTo1xScaler) {
-#ifdef ENABLE_RGB_COLOR
-	initGraphics(width,height,defaultTo1xScaler, Graphics::PixelFormat::createFormatCLUT8());
-}
-void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::PixelFormat format) {
-#endif
+void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::PixelFormat *format) {
 
 	g_system->beginGFXTransaction();
 

Modified: scummvm/branches/gsoc2009-16bit/engines/engine.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/engine.h	2009-06-27 05:10:24 UTC (rev 41908)
+++ scummvm/branches/gsoc2009-16bit/engines/engine.h	2009-06-27 05:58:44 UTC (rev 41909)
@@ -29,9 +29,7 @@
 #include "common/error.h"
 #include "common/fs.h"
 #include "common/str.h"
-#ifdef ENABLE_RGB_COLOR
 #include "graphics/pixelformat.h"
-#endif
 
 class OSystem;
 
@@ -62,10 +60,7 @@
  * Errors out when backend is not able to switch to the specified
  * mode.
  */
-#ifdef ENABLE_RGB_COLOR
-void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::PixelFormat format);
-#endif
-void initGraphics(int width, int height, bool defaultTo1xScaler);
+void initGraphics(int width, int height, bool defaultTo1xScaler, Graphics::PixelFormat *format = NULL);
 
 /**
  * Initializes graphics and shows error message.

Modified: scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp	2009-06-27 05:10:24 UTC (rev 41908)
+++ scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp	2009-06-27 05:58:44 UTC (rev 41909)
@@ -74,7 +74,7 @@
 	case kGroovieV2:
 #ifdef ENABLE_RGB_COLOR
 		_pixelFormat = _system->getSupportedFormats().front();
-		initGraphics(640, 480, true, _pixelFormat);
+		initGraphics(640, 480, true, &_pixelFormat);
 		break;
 #endif
 	case kGroovieT7G:

Modified: scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp	2009-06-27 05:10:24 UTC (rev 41908)
+++ scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp	2009-06-27 05:58:44 UTC (rev 41909)
@@ -1086,7 +1086,7 @@
 	} else if (_game.features & GF_16BIT_COLOR) {
 #ifdef ENABLE_RGB_COLOR
 		Graphics::PixelFormat format = Graphics::PixelFormat::createFormatRGB555();
-		initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, format);
+		initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, &format);
 		if (format != _system->getScreenFormat())
 			return Common::kUnsupportedColorMode;
 #else


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