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

upthorn at users.sourceforge.net upthorn at users.sourceforge.net
Tue Jul 7 09:50:41 CEST 2009


Revision: 42207
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42207&view=rev
Author:   upthorn
Date:     2009-07-07 07:50:40 +0000 (Tue, 07 Jul 2009)

Log Message:
-----------
Removed PixelFormat convenience constructors at behest of Max and Eugene.

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

Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp	2009-07-07 07:44:25 UTC (rev 42206)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp	2009-07-07 07:50:40 UTC (rev 42207)
@@ -361,7 +361,7 @@
 	//avoid redundant format changes
 	Graphics::PixelFormat newFormat;
 	if (!format)
-		newFormat = Graphics::PixelFormat::createFormatCLUT8();
+		newFormat = Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
 	else
 		newFormat = *format;
 

Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.cpp	2009-07-07 07:44:25 UTC (rev 42206)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.cpp	2009-07-07 07:50:40 UTC (rev 42207)
@@ -197,8 +197,8 @@
 #endif
 	_hwscreen(0), _screen(0), _tmpscreen(0),
 #ifdef ENABLE_RGB_COLOR
-	_screenFormat(Graphics::PixelFormat::createFormatCLUT8()),
-	_cursorFormat(Graphics::PixelFormat::createFormatCLUT8()),
+	_screenFormat(Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0)),
+	_cursorFormat(Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0)),
 #endif
 	_overlayVisible(false),
 	_overlayscreen(0), _tmpscreen2(0),

Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h	2009-07-07 07:44:25 UTC (rev 42206)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h	2009-07-07 07:50:40 UTC (rev 42207)
@@ -94,29 +94,44 @@
 		if (HWFormat->BitsPerPixel >= 32)
 		{
 			list.push_back(Graphics::PixelFormat::createFormatRGBA8888());
-			list.push_back(Graphics::PixelFormat::createFormatARGB8888());
-			list.push_back(Graphics::PixelFormat::createFormatABGR8888());
-			list.push_back(Graphics::PixelFormat::createFormatBGRA8888());			}
+			list.push_back(Graphics::PixelFormat(4, 0, 0, 0, 0, 16, 8, 0, 24)
+);
+			list.push_back(Graphics::PixelFormat(4, 0, 0, 0, 0, 0, 8, 16, 24)
+);
+			list.push_back(Graphics::PixelFormat(4, 0, 0, 0, 0, 8, 16, 24, 0)
+);			}
 		if (HWFormat->BitsPerPixel >= 24)
 		{
-			list.push_back(Graphics::PixelFormat::createFormatRGB888());
-			list.push_back(Graphics::PixelFormat::createFormatBGR888());
+			list.push_back(Graphics::PixelFormat(3, 0, 0, 0, 8, 16, 8, 0, 0)
+);
+			list.push_back(Graphics::PixelFormat(3, 0, 0, 0, 8, 0, 8, 16, 0)
+);
 		}
 #endif  //ENABLE_32BIT
 		if (HWFormat->BitsPerPixel >= 16)
 		{
-			list.push_back(Graphics::PixelFormat::createFormatRGB565());
-			list.push_back(Graphics::PixelFormat::createFormatXRGB1555());
-			list.push_back(Graphics::PixelFormat::createFormatRGB555());
-			list.push_back(Graphics::PixelFormat::createFormatRGBA4444());
-			list.push_back(Graphics::PixelFormat::createFormatARGB4444());
-			list.push_back(Graphics::PixelFormat::createFormatBGR565());
-			list.push_back(Graphics::PixelFormat::createFormatXBGR1555());
-			list.push_back(Graphics::PixelFormat::createFormatBGR555());
-			list.push_back(Graphics::PixelFormat::createFormatABGR4444());
-			list.push_back(Graphics::PixelFormat::createFormatBGRA4444());
+			list.push_back(Graphics::PixelFormat(2, 3, 2, 3, 8, 11, 5, 0, 0)
+);
+			list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 7, 10, 5, 0, 15)
+);
+			list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0)
+);
+			list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0)
+);
+			list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 8, 4, 0, 12)
+);
+			list.push_back(Graphics::PixelFormat(2, 3, 2, 3, 8, 0, 5, 11, 0)
+);
+			list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 7, 0, 5, 10, 15)
+);
+			list.push_back(Graphics::PixelFormat(2, 3, 3, 3, 8, 0, 5, 10, 0)
+);
+			list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 0, 4, 8, 12)
+);
+			list.push_back(Graphics::PixelFormat(2, 4, 4, 4, 4, 4, 8, 12, 0)
+);
 		}
-		list.push_back(Graphics::PixelFormat::createFormatCLUT8());
+		list.push_back(Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0));
 		return list;
 	}
 #endif

Modified: scummvm/branches/gsoc2009-16bit/common/system.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/common/system.h	2009-07-07 07:44:25 UTC (rev 42206)
+++ scummvm/branches/gsoc2009-16bit/common/system.h	2009-07-07 07:50:40 UTC (rev 42207)
@@ -368,11 +368,14 @@
 	 *
 	 * EG: a backend that supports 32-bit ABGR and 16-bit 555 BGR in hardware
 	 * and provides conversion from equivalent RGB(A) modes should order its list
-	 *    1) Graphics::PixelFormat::createFormatABGR8888()
-	 *    2) Graphics::PixelFormat::createFormatBGR555()
-	 *    3) Graphics::PixelFormat::createFormatRGBA8888()
-	 *    4) Graphics::PixelFormat::createFormatRGB555()
-	 *    5) Graphics::PixelFormat::createFormatCLUT8()
+	 *    1) Graphics::PixelFormat(4, 0, 0, 0, 0, 0, 8, 16, 24)
+
+	 *    2) Graphics::PixelFormat(2, 3, 3, 3, 8, 0, 5, 10, 0)
+
+	 *    3) Graphics::PixelFormat(4, 0, 0, 0, 0, 24, 16, 8, 0)
+	 *    4) Graphics::PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0)
+
+	 *    5) Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0)
 	 *
 	 * @see Graphics::PixelFormat
 	 *
@@ -384,12 +387,12 @@
 	virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const = 0;
 #else
 	inline Graphics::PixelFormat getScreenFormat() const {
-		return Graphics::PixelFormat::createFormatCLUT8();
+		return Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
 	};
 
 	inline Common::List<Graphics::PixelFormat> getSupportedFormats() const {
 		Common::List<Graphics::PixelFormat> list;
-		list.push_back(Graphics::PixelFormat::createFormatCLUT8());
+		list.push_back(Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0));
 		return list;
 	};
 #endif

Modified: scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp	2009-07-07 07:44:25 UTC (rev 42206)
+++ scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp	2009-07-07 07:50:40 UTC (rev 42207)
@@ -78,11 +78,11 @@
 
 		// Save the enabled mode as it can be both an RGB mode or CLUT8
 		_pixelFormat = _system->getScreenFormat();
-		_mode8bit = (_pixelFormat == Graphics::PixelFormat::createFormatCLUT8());
+		_mode8bit = (_pixelFormat == Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0));
 		break;
 	case kGroovieT7G:
 		initGraphics(640, 480, true);
-		_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
+		_pixelFormat = Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
 		break;
 	}
 

Modified: scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp	2009-07-07 07:44:25 UTC (rev 42206)
+++ scummvm/branches/gsoc2009-16bit/engines/scumm/scumm.cpp	2009-07-07 07:50:40 UTC (rev 42207)
@@ -1085,7 +1085,8 @@
 					(_screenWidth * _textSurfaceMultiplier > 320));
 	} else if (_game.features & GF_16BIT_COLOR) {
 #ifdef ENABLE_RGB_COLOR
-		Graphics::PixelFormat format = Graphics::PixelFormat::createFormatRGB555();
+		Graphics::PixelFormat format = Graphics::PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0)
+;
 		initGraphics(_screenWidth, _screenHeight, _screenWidth > 320, &format);
 		if (format != _system->getScreenFormat())
 			return Common::kUnsupportedColorMode;

Modified: scummvm/branches/gsoc2009-16bit/graphics/cursorman.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/graphics/cursorman.cpp	2009-07-07 07:44:25 UTC (rev 42206)
+++ scummvm/branches/gsoc2009-16bit/graphics/cursorman.cpp	2009-07-07 07:50:40 UTC (rev 42207)
@@ -138,7 +138,7 @@
 	if (format)
 		cur->_format = *format;
 	else
-		cur->_format = Graphics::PixelFormat::createFormatCLUT8();
+		cur->_format = Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
 #endif
 
 	g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale, format);

Modified: scummvm/branches/gsoc2009-16bit/graphics/cursorman.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/graphics/cursorman.h	2009-07-07 07:44:25 UTC (rev 42206)
+++ scummvm/branches/gsoc2009-16bit/graphics/cursorman.h	2009-07-07 07:50:40 UTC (rev 42207)
@@ -181,13 +181,13 @@
 		Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, const Graphics::PixelFormat *format = NULL) {
 #ifdef ENABLE_RGB_COLOR
 			if (!format)
-				_format = Graphics::PixelFormat::createFormatCLUT8();
+				_format = Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
 			 else 
 				_format = *format;
 			_size = w * h * _format.bytesPerPixel;
 			_keycolor &= ((1 << (_format.bytesPerPixel << 3)) - 1);
 #else
-			_format = Graphics::PixelFormat::createFormatCLUT8();
+			_format = Graphics::PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
 			_size = w * h;
 			_keycolor &= 0xFF;
 #endif

Modified: scummvm/branches/gsoc2009-16bit/graphics/pixelformat.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/graphics/pixelformat.h	2009-07-07 07:44:25 UTC (rev 42206)
+++ scummvm/branches/gsoc2009-16bit/graphics/pixelformat.h	2009-07-07 07:50:40 UTC (rev 42207)
@@ -65,67 +65,6 @@
 		rShift = RShift, gShift = GShift, bShift = BShift, aShift = AShift;
 	}
 
-	/////////////////////////////////////////////////////////
-	// Convenience functions for creating standard formats //
-	/////////////////////////////////////////////////////////
-
-	// 256 color palette.
-	static inline PixelFormat createFormatCLUT8() { 
-		return PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
-	}
-	// 2 Bytes-per-pixel modes
-	static inline PixelFormat createFormatRGB555() {
-		return PixelFormat(2, 3, 3, 3, 8, 10, 5, 0, 0);
-	}
-	static inline PixelFormat createFormatBGR555() {
-		return PixelFormat(2, 3, 3, 3, 8, 0, 5, 10, 0);
-	}
-	static inline PixelFormat createFormatXRGB1555() {
-		// Special case, alpha bit is always high in this mode.
-		return PixelFormat(2, 3, 3, 3, 7, 10, 5, 0, 15);
-	}
-	static inline PixelFormat createFormatXBGR1555() {
-		// Special case, alpha bit is always high in this mode.
-		return PixelFormat(2, 3, 3, 3, 7, 0, 5, 10, 15);
-	}
-	static inline PixelFormat createFormatRGB565() {
-		return PixelFormat(2, 3, 2, 3, 8, 11, 5, 0, 0);
-	}
-	static inline PixelFormat createFormatBGR565() {
-		return PixelFormat(2, 3, 2, 3, 8, 0, 5, 11, 0);
-	}
-	static inline PixelFormat createFormatRGBA4444() {
-		return PixelFormat(2, 4, 4, 4, 4, 12, 8, 4, 0);
-	}
-	static inline PixelFormat createFormatARGB4444() {
-		return PixelFormat(2, 4, 4, 4, 4, 8, 4, 0, 12);
-	}
-	static inline PixelFormat createFormatABGR4444() {
-		return PixelFormat(2, 4, 4, 4, 4, 0, 4, 8, 12);
-	}
-	static inline PixelFormat createFormatBGRA4444() {
-		return PixelFormat(2, 4, 4, 4, 4, 4, 8, 12, 0);
-	}
-	// 3 to 4 byte per pixel modes
-	static inline PixelFormat createFormatRGB888() {
-		return PixelFormat(3, 0, 0, 0, 8, 16, 8, 0, 0);
-	}
-	static inline PixelFormat createFormatBGR888() {
-		return PixelFormat(3, 0, 0, 0, 8, 0, 8, 16, 0);
-	}
-	static inline PixelFormat createFormatRGBA8888() {
-		return PixelFormat(4, 0, 0, 0, 0, 24, 16, 8, 0);
-	}
-	static inline PixelFormat createFormatARGB8888() {
-		return PixelFormat(4, 0, 0, 0, 0, 16 ,8, 0, 24);
-	}
-	static inline PixelFormat createFormatABGR8888() {
-		return PixelFormat(4, 0, 0, 0, 0, 0, 8, 16, 24);
-	}
-	static inline PixelFormat createFormatBGRA8888() {
-		return PixelFormat(4, 0, 0, 0, 0, 8, 16, 24, 0);
-	}
-
 	inline bool operator==(const PixelFormat &fmt) const {
 		// TODO: If aLoss==8, then the value of aShift is irrelevant, and should be ignored.
 		return 0 == memcmp(this, &fmt, sizeof(PixelFormat));
@@ -211,7 +150,7 @@
  * @param backend	The higher priority list, meant to be a list of formats supported by the backend
  * @param frontend	The lower priority list, meant to be a list of formats supported by the engine
  * @return			The first item on the backend list that also occurs on the frontend list
- *					or PixelFormat::createFormatCLUT8() if no matching formats were found.
+ *					or PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0) if no matching formats were found.
  */
 inline PixelFormat findCompatibleFormat(Common::List<PixelFormat> backend, Common::List<PixelFormat> frontend) {
 #ifdef ENABLE_RGB_COLOR
@@ -222,7 +161,7 @@
 		}
 	}
 #endif
-	return PixelFormat::createFormatCLUT8();
+	return PixelFormat(1, 8, 8, 8, 8, 0, 0, 0, 0);
 }
 
 } // end of namespace Graphics


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