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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Jan 7 16:29:13 CET 2010


Revision: 47123
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47123&view=rev
Author:   lordhoto
Date:     2010-01-07 15:28:58 +0000 (Thu, 07 Jan 2010)

Log Message:
-----------
- Adapt documentation, that keycolor in setMouseCursor may not exceed the maximum color value of the specified format.
- Change SDL backend to assert out on invalid keycolor values

In case we really need a way to specify "no keycolor" we need to
discuss on how to do it *properly*.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/sdl/graphics.cpp
    scummvm/trunk/common/system.h
    scummvm/trunk/graphics/cursorman.h

Modified: scummvm/trunk/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/graphics.cpp	2010-01-07 15:25:14 UTC (rev 47122)
+++ scummvm/trunk/backends/platform/sdl/graphics.cpp	2010-01-07 15:28:58 UTC (rev 47123)
@@ -1490,9 +1490,11 @@
 		_cursorFormat = Graphics::PixelFormat::createFormatCLUT8();
 	else if (format->bytesPerPixel <= _screenFormat.bytesPerPixel)
 		_cursorFormat = *format;
-	keycolor &= (1 << (_cursorFormat.bytesPerPixel << 3)) - 1;
+
+	if (_cursorFormat.bytesPerPixel < 4)
+		assert(keycolor < (uint)(1 << (_cursorFormat.bytesPerPixel << 3)));
 #else
-	keycolor &= 0xFF;
+	assert(keycolor <= 0xFF);
 #endif
 
 	if (w == 0 || h == 0)

Modified: scummvm/trunk/common/system.h
===================================================================
--- scummvm/trunk/common/system.h	2010-01-07 15:25:14 UTC (rev 47122)
+++ scummvm/trunk/common/system.h	2010-01-07 15:28:58 UTC (rev 47123)
@@ -770,14 +770,16 @@
 	/**
 	 * Set the bitmap used for drawing the cursor.
 	 *
-	 * @param buf				the pixmap data to be used (8bit/pixel)
+	 * @param buf				the pixmap data to be used
 	 * @param w					width of the mouse cursor
 	 * @param h					height of the mouse cursor
 	 * @param hotspotX			horizontal offset from the left side to the hotspot
 	 * @param hotspotY			vertical offset from the top side to the hotspot
-	 * @param keycolor			transparency color index
+	 * @param keycolor			transparency color value. This should not exceed the maximum color value of the specified format.
+	 *                          In case it does the behavior is undefined. The backend might just error out or simply ignore the
+	 *                          value. (The SDL backend will just assert to prevent abuse of this).
 	 * @param cursorTargetScale	scale factor which cursor is designed for
-	 * @param format			pointer to the pixel format which cursor graphic uses
+	 * @param format			pointer to the pixel format which cursor graphic uses (0 means screen format)
 	 */
 	virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) = 0;
 

Modified: scummvm/trunk/graphics/cursorman.h
===================================================================
--- scummvm/trunk/graphics/cursorman.h	2010-01-07 15:25:14 UTC (rev 47122)
+++ scummvm/trunk/graphics/cursorman.h	2010-01-07 15:28:58 UTC (rev 47123)
@@ -64,7 +64,8 @@
 	 * @param h			the height
 	 * @param hotspotX	the hotspot X coordinate
 	 * @param hotspotY	the hotspot Y coordinate
-	 * @param keycolor	the index for the transparent color
+	 * @param keycolor	the color value for the transparent color. This may not exceed
+	 *                  the maximum color value as defined by format.
 	 * @param targetScale	the scale for which the cursor is designed
 	 * @param format	a pointer to the pixel format which the cursor graphic uses, 
 	 *					CLUT8 will be used if this is NULL or not specified.
@@ -90,7 +91,8 @@
 	 * @param h		the height
 	 * @param hotspotX	the hotspot X coordinate
 	 * @param hotspotY	the hotspot Y coordinate
-	 * @param keycolor	the index for the transparent color
+	 * @param keycolor	the color value for the transparent color. This may not exceed
+	 *                  the maximum color value as defined by format.
 	 * @param targetScale	the scale for which the cursor is designed
 	 * @param format	a pointer to the pixel format which the cursor graphic uses,
 	 *					CLUT8 will be used if this is NULL or not specified.


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