[Scummvm-cvs-logs] SF.net SVN: scummvm: [28517] scummvm/trunk/common

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Aug 11 10:05:04 CEST 2007


Revision: 28517
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28517&view=rev
Author:   fingolfin
Date:     2007-08-11 01:05:03 -0700 (Sat, 11 Aug 2007)

Log Message:
-----------
Changed OSystem (A)RGBToColor and colorTo(A)RGB methods to use ColorMasks templates; clarified some OSystem comments

Modified Paths:
--------------
    scummvm/trunk/common/system.cpp
    scummvm/trunk/common/system.h

Modified: scummvm/trunk/common/system.cpp
===================================================================
--- scummvm/trunk/common/system.cpp	2007-08-11 08:02:19 UTC (rev 28516)
+++ scummvm/trunk/common/system.cpp	2007-08-11 08:05:03 UTC (rev 28517)
@@ -28,13 +28,13 @@
 #include "backends/intern.h"
 #include "backends/events/default/default-events.h"
 
-#include "gui/message.h"
-
 #include "common/config-manager.h"
 #include "common/system.h"
 #include "common/timer.h"
 #include "common/util.h"
 
+#include "graphics/colormasks.h"
+#include "gui/message.h"
 #include "sound/mixer.h"
 
 OSystem *g_system = 0;
@@ -66,6 +66,23 @@
 	return false;
 }
 
+OverlayColor OSystem::RGBToColor(uint8 r, uint8 g, uint8 b) {
+	return ::RGBToColor<ColorMasks<565> >(r, g, b);
+}
+
+void OSystem::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
+	::colorToRGB<ColorMasks<565> >(color, r, g, b);
+}
+
+OverlayColor OSystem::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) {
+	return RGBToColor(r, g, b);
+}
+
+void OSystem::colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) {
+	colorToRGB(color, r, g, b);
+	a = 255;
+}
+
 void OSystem::displayMessageOnOSD(const char *msg) {
 	// Display the message for 1.5 seconds
 	GUI::TimedMessageDialog dialog(msg, 1500);

Modified: scummvm/trunk/common/system.h
===================================================================
--- scummvm/trunk/common/system.h	2007-08-11 08:02:19 UTC (rev 28516)
+++ scummvm/trunk/common/system.h	2007-08-11 08:05:03 UTC (rev 28517)
@@ -495,17 +495,16 @@
 	virtual void updateScreen() = 0;
 
 	/**
-	 * Set current shake position, a feature needed for some SCUMM screen effects.
-	 * The effect causes the displayed graphics to be shifted upwards by the specified
-	 * (always positive) offset. The area at the bottom of the screen which is moved
-	 * into view by this is filled by black. This does not cause any graphic data to
-	 * be lost - that is, to restore the original view, the game engine only has to
-	 * call this method again with a 0 offset. No calls to copyRectToScreen are necessary.
+	 * Set current shake position, a feature needed for some SCUMM screen
+	 * effects. The effect causes the displayed graphics to be shifted upwards
+	 * by the specified (always positive) offset. The area at the bottom of the
+	 * screen which is moved into view by this is filled with black. This does
+	 * not cause any graphic data to be lost - that is, to restore the original
+	 * view, the game engine only has to call this method again with offset
+	 * equal to zero. No calls to copyRectToScreen are necessary.
 	 * @param shakeOffset	the shake offset
 	 *
-	 * @todo This is a rather special screen effect, only used by the SCUMM
-	 *       frontend - we should consider removing it from the backend API
-	 *       and instead implement the functionality in the frontend.
+	 * @note This is currently used in the SCUMM, QUEEN and KYRA engines.
 	 */
 	virtual void setShakePos(int shakeOffset) = 0;
 		
@@ -549,8 +548,10 @@
 	 * 8bpp), this needs some trickery.
 	 *
 	 * Essentially, we fake (alpha) blending on these systems by copying the
-	 * game graphics into the overlay buffer, then manually compose whatever
-	 * graphics we want to show in the overlay.
+	 * current game graphics into the overlay buffer when activating the overlay,
+	 * then manually compose whatever graphics we want to show in the overlay.
+	 * This works because we assume the game to be "paused" whenever an overlay
+	 * is active.
 	 */
 	//@{
 
@@ -607,9 +608,7 @@
 	 * @see colorToRGB
 	 * @see ARGBToColor
 	 */
-	virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b) {
-		return ((((r >> 3) & 0x1F) << 11) | (((g >> 2) & 0x3F) << 5) | ((b >> 3) & 0x1F));
-	}
+	virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
 
 	/**
 	 * Convert the given OverlayColor into a RGB triplet. An OverlayColor can
@@ -619,14 +618,10 @@
 	 * @see RGBToColor
 	 * @see colorToARGB
 	 */
-	virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
-		r = (((color >> 11) & 0x1F) << 3);
-		g = (((color >> 5) & 0x3F) << 2);
-		b = ((color&0x1F) << 3);
-	}
+	virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
 
 	/**
-	* Convert the given ARGB quadruplet into an OverlayColor. A OverlayColor can
+	 * Convert the given ARGB quadruplet into an OverlayColor. A OverlayColor can
 	 * be 8bit, 16bit or 32bit, depending on the target system. The default
 	 * implementation generates a 16 bit color value, in the 565 format
 	 * (that is, 5 bits red, 6 bits green, 5 bits blue).
@@ -634,9 +629,7 @@
 	 * @see colorToRGB
 	 * @see RGBToColor
 	 */
-	virtual OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) {
-		return RGBToColor(r, g, b);
-	}
+	virtual OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b);
 
 	/**
 	 * Convert the given OverlayColor into an ARGB quadruplet. An OverlayColor can
@@ -647,10 +640,7 @@
 	 * @see ARGBToColor
 	 * @see colorToRGB
 	 */
-	virtual void colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) {
-		colorToRGB(color, r, g, b);
-		a = 255;
-	}
+	virtual void colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b);
 
 	//@}
 


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