[Scummvm-cvs-logs] SF.net SVN: scummvm:[40116] scummvm/trunk/engines/sci/gfx
waltervn at users.sourceforge.net
waltervn at users.sourceforge.net
Fri Apr 24 16:30:27 CEST 2009
Revision: 40116
http://scummvm.svn.sourceforge.net/scummvm/?rev=40116&view=rev
Author: waltervn
Date: 2009-04-24 14:30:27 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
SCI: Fix transparency in view-based mouse cursors.
Modified Paths:
--------------
scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
scummvm/trunk/engines/sci/gfx/gfx_system.h
scummvm/trunk/engines/sci/gfx/res_cursor.cpp
Modified: scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_driver.cpp 2009-04-24 14:22:14 UTC (rev 40115)
+++ scummvm/trunk/engines/sci/gfx/gfx_driver.cpp 2009-04-24 14:30:27 UTC (rev 40116)
@@ -271,7 +271,8 @@
for (int xc = 0; xc < pointer->index_width; xc++) {
uint8 color = *src;
- if (color != 255)
+ // FIXME: The palette size check is a workaround for cursors using non-palette colour GFX_CURSOR_TRANSPARENT
+ if (color < pointer->palette->size())
color = pointer->palette->getColor(color).parent_index;
for (int scalectr = 0; scalectr < drv->mode->xfact; scalectr++) {
*pos++ = color;
@@ -292,7 +293,13 @@
} else {
delete[] S->pointer_data;
S->pointer_data = create_cursor(drv, pointer, 1);
- g_system->setMouseCursor(S->pointer_data, pointer->width, pointer->height, hotspot->x, hotspot->y);
+
+ // FIXME: The palette size check is a workaround for cursors using non-palette colour GFX_CURSOR_TRANSPARENT
+ uint8 color_key = GFX_CURSOR_TRANSPARENT;
+ if ((pointer->color_key != GFX_PIXMAP_COLOR_KEY_NONE) && ((unsigned int)pointer->color_key < pointer->palette->size()))
+ color_key = pointer->palette->getColor(pointer->color_key).parent_index;
+
+ g_system->setMouseCursor(S->pointer_data, pointer->width, pointer->height, hotspot->x, hotspot->y, color_key);
g_system->showMouse(true);
}
Modified: scummvm/trunk/engines/sci/gfx/gfx_system.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_system.h 2009-04-24 14:22:14 UTC (rev 40115)
+++ scummvm/trunk/engines/sci/gfx/gfx_system.h 2009-04-24 14:30:27 UTC (rev 40116)
@@ -164,6 +164,7 @@
#define GFX_PIXMAP_FLAG_PALETTIZED (1<<6) /* Indicates a palettized view */
#define GFX_PIXMAP_COLOR_KEY_NONE -1 /* No transpacency colour key */
+#define GFX_CURSOR_TRANSPARENT 255 // Cursor colour key
struct gfx_pixmap_t { /* gfx_pixmap_t: Pixel map */
Modified: scummvm/trunk/engines/sci/gfx/res_cursor.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/res_cursor.cpp 2009-04-24 14:22:14 UTC (rev 40115)
+++ scummvm/trunk/engines/sci/gfx/res_cursor.cpp 2009-04-24 14:30:27 UTC (rev 40116)
@@ -37,8 +37,6 @@
#define GFX_SCI01_CURSOR_COLORS_NR 3
#define GFX_SCI0_CURSOR_COLORS_NR 2
-#define GFX_CURSOR_TRANSPARENT 255
-
gfx_pixmap_color_t gfx_sci01_cursor_colors[GFX_SCI01_CURSOR_COLORS_NR] = {
{GFX_COLOR_INDEX_UNMAPPED, 0x00, 0x00, 0x00},
{GFX_COLOR_INDEX_UNMAPPED, 0xff, 0xff, 0xff},
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