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

upthorn at users.sourceforge.net upthorn at users.sourceforge.net
Tue Jun 23 04:02:51 CEST 2009


Revision: 41801
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41801&view=rev
Author:   upthorn
Date:     2009-06-23 02:02:51 +0000 (Tue, 23 Jun 2009)

Log Message:
-----------
Merged format initialization into InitSize to allow for backends not supporting gfx transactions.

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

Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp	2009-06-23 01:41:34 UTC (rev 41800)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp	2009-06-23 02:02:51 UTC (rev 41801)
@@ -353,23 +353,22 @@
 	assert (_transactionMode == kTransactionNone);
 	return _videoMode.mode;
 }
-#ifdef ENABLE_RGB_COLOR
-void OSystem_SDL::initFormat(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
-	if (format == _videoMode.format)
-		return;
+	assert(format.bytesPerPixel > 0);
 
-	_videoMode.format = format;
-	_transactionDetails.formatChanged = true;
-	_screenFormat = format;
-}
+	if (format != _videoMode.format)
+	{
+		_videoMode.format = format;
+		_transactionDetails.formatChanged = true;
+		_screenFormat = format;
+	}
 #endif
 
-void OSystem_SDL::initSize(uint w, uint h) {
-	assert(_transactionMode == kTransactionActive);
-
 	// Avoid redundant res changes
 	if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)
 		return;

Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h	2009-06-23 01:41:34 UTC (rev 41800)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h	2009-06-23 02:02:51 UTC (rev 41801)
@@ -82,10 +82,6 @@
 	TransactionError endGFXTransaction(void);
 
 #ifdef ENABLE_RGB_COLOR
-	// Set the depth and format of the video bitmap
-	// Typically, CLUT8
-	virtual void initFormat(Graphics::PixelFormat format);
-
 	// Game screen
 	virtual Graphics::PixelFormat getScreenFormat() const { return _screenFormat; }
 
@@ -108,9 +104,9 @@
 	}
 #endif
 
-	// Set the size of the video bitmap.
-	// Typically, 320x200
-	virtual void initSize(uint w, uint h); // overloaded by CE backend
+	// 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 int getScreenChangeID() const { return _screenChangeCount; }
 

Modified: scummvm/branches/gsoc2009-16bit/base/main.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/base/main.cpp	2009-06-23 01:41:34 UTC (rev 41800)
+++ scummvm/branches/gsoc2009-16bit/base/main.cpp	2009-06-23 02:02:51 UTC (rev 41801)
@@ -226,9 +226,6 @@
 		// Set the user specified graphics mode (if any).
 		system.setGraphicsMode(ConfMan.get("gfx_mode").c_str());
 
-#ifdef ENABLE_RGB_COLOR
-			system.initFormat(Graphics::PixelFormat::createFormatCLUT8());
-#endif
 		system.initSize(320, 200);
 
 		if (ConfMan.hasKey("aspect_ratio"))

Modified: scummvm/branches/gsoc2009-16bit/common/system.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/common/system.h	2009-06-23 01:41:34 UTC (rev 41800)
+++ scummvm/branches/gsoc2009-16bit/common/system.h	2009-06-23 02:02:51 UTC (rev 41801)
@@ -345,21 +345,6 @@
 
 #ifdef ENABLE_RGB_COLOR
 	/**
-	 * Set the color format of the virtual screen. Typical formats include:
-	 *  CLUT8 (e.g. 256 color, for most games)
-	 *  RGB555 (e.g. 16-bit color, for later SCUMM HE games)
-	 *  RGB565 (e.g. 16-bit color, for Urban Runner)
-	 *
-	 * This is the pixel format for which the client code generates data;
-	 * this is not necessarily equal to the hardware pixel format. For example,
-	 * a backend may perform color lookup of 8-bit graphics before pushing
-	 * a screen to hardware, or correct the ARGB color order.
-	 *
-	 * @param format	A pixel format that the backend screen will use
-	 */
-	virtual void initFormat(Graphics::PixelFormat format) = 0;
-
-	/**
 	 * Returns the pixel format of the screen.
 	 * @see Graphics::PixelFormat
 	 */
@@ -373,7 +358,7 @@
 #endif
 
 	/**
-	 * Set the size of the virtual screen. Typical sizes include:
+	 * Set the size and color format of the virtual screen. Typical sizes include:
 	 *  - 320x200 (e.g. for most SCUMM games, and Simon)
 	 *  - 320x240 (e.g. for FM-TOWN SCUMM games)
 	 *  - 640x480 (e.g. for Curse of Monkey Island)
@@ -384,10 +369,21 @@
 	 * GraphicsMode); stretch the data to perform aspect ratio correction;
 	 * or shrink it to fit on small screens (in cell phones).
 	 *
+	 * Typical formats include:
+	 *  CLUT8 (e.g. 256 color, for most games)
+	 *  RGB555 (e.g. 16-bit color, for later SCUMM HE games)
+	 *  RGB565 (e.g. 16-bit color, for Urban Runner)
+	 *
+	 * This is the pixel format for which the client code generates data;
+	 * this is not necessarily equal to the hardware pixel format. For example,
+	 * a backend may perform color lookup of 8-bit graphics before pushing
+	 * a screen to hardware, or correct the ARGB color order.
+	 *
 	 * @param width		the new virtual screen width
 	 * @param height	the new virtual screen height
+	 * @param format	the new virtual screen pixel format
 	 */
-	virtual void initSize(uint width, uint height) = 0;
+	virtual void initSize(uint width, uint height, Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8()) = 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-23 01:41:34 UTC (rev 41800)
+++ scummvm/branches/gsoc2009-16bit/engines/engine.cpp	2009-06-23 02:02:51 UTC (rev 41801)
@@ -135,9 +135,10 @@
 
 		initCommonGFX(defaultTo1xScaler);
 #ifdef ENABLE_RGB_COLOR
-		g_system->initFormat(format);
+		g_system->initSize(width, height, format);
+#else
+		g_system->initSize(width, height);
 #endif
-		g_system->initSize(width, height);
 
 	OSystem::TransactionError gfxError = g_system->endGFXTransaction();
 


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