[Scummvm-cvs-logs] CVS: scummvm/backends/sdl graphics.cpp,1.9,1.10 sdl-common.h,1.58,1.59
Eugene Sandulenko
sev at users.sourceforge.net
Tue May 4 19:31:04 CEST 2004
Update of /cvsroot/scummvm/scummvm/backends/sdl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22596/sdl
Modified Files:
graphics.cpp sdl-common.h
Log Message:
Extend setMouseCursor with additional keycolor parameter. Lets saga use 255
as white color. Made this function more safe by copying cursor data to
newly created buffer.
Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/graphics.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- graphics.cpp 28 Mar 2004 20:31:17 -0000 1.9
+++ graphics.cpp 5 May 2004 02:30:15 -0000 1.10
@@ -175,6 +175,8 @@
free(_dirty_checksums);
_dirty_checksums = (uint32 *)calloc(CKSUM_NUM * 2, sizeof(uint32));
+ _mouseData = NULL;
+
unload_gfx_mode();
load_gfx_mode();
}
@@ -992,7 +994,7 @@
}
}
-void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) {
+void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor) {
undraw_mouse();
@@ -1004,7 +1006,13 @@
_mouseHotspotX = hotspot_x;
_mouseHotspotY = hotspot_y;
- _mouseData = buf;
+ _mouseKeycolor = keycolor;
+
+ if (_mouseData)
+ free(_mouseData);
+
+ _mouseData = (byte *)malloc(w * h);
+ memcpy(_mouseData, buf, w * h);
}
void OSystem_SDL::toggleMouseGrab() {
@@ -1063,7 +1071,7 @@
while (width > 0) {
*bak++ = *dst;
color = *src++;
- if (color != 0xFF) // 0xFF = transparent, don't draw
+ if (color != _mouseKeycolor) // transparent, don't draw
*dst = color;
dst++;
width--;
Index: sdl-common.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- sdl-common.h 28 Mar 2004 20:31:17 -0000 1.58
+++ sdl-common.h 5 May 2004 02:30:15 -0000 1.59
@@ -64,7 +64,7 @@
void warpMouse(int x, int y);
// Set the bitmap that's used when drawing the cursor.
- void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y);
+ void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor = 255);
// Shaking is used in SCUMM. Set current shake position.
void set_shake_pos(int shake_pos);
@@ -217,11 +217,12 @@
// mouse
bool _mouseVisible;
bool _mouseDrawn;
- const byte *_mouseData;
+ byte *_mouseData;
byte *_mouseBackup;
MousePos _mouseCurState;
int16 _mouseHotspotX;
int16 _mouseHotspotY;
+ byte _mouseKeycolor;
// joystick
SDL_Joystick *_joystick;
More information about the Scummvm-git-logs
mailing list