[Scummvm-cvs-logs] CVS: scummvm/backends/x11 x11.cpp,1.28,1.29
Eugene Sandulenko
sev at users.sourceforge.net
Tue May 4 19:31:08 CEST 2004
Update of /cvsroot/scummvm/scummvm/backends/x11
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22596/x11
Modified Files:
x11.cpp
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: x11.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/x11/x11.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- x11.cpp 28 Mar 2004 16:30:47 -0000 1.28
+++ x11.cpp 5 May 2004 02:30:16 -0000 1.29
@@ -107,7 +107,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);
@@ -222,9 +222,10 @@
int hot_x, hot_y;
} mouse_state;
mouse_state old_state, cur_state;
- const byte *_ms_buf;
+ byte *_ms_buf;
bool _mouse_visible;
bool _mouse_state_changed;
+ byte _mouseKeycolor;
uint32 _timer_duration, _timer_next_expiry;
bool _timer_active;
@@ -363,6 +364,7 @@
_overlay_visible = false;
_mouse_state_changed = true;
_mouse_visible = true;
+ _ms_buf = NULL;
cur_state.x = 0;
cur_state.y = 0;
cur_state.hot_x = 0;
@@ -780,7 +782,7 @@
int width = real_w;
while (width > 0) {
byte color = *buf;
- if (color != 0xFF) {
+ if (color != _mouseKeycolor) {
*dst = palette[color];
}
buf++;
@@ -808,16 +810,21 @@
set_mouse_pos(x, y);
}
-void OSystem_X11::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y) {
+void OSystem_X11::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor) {
cur_state.w = w;
cur_state.h = h;
cur_state.hot_x = hotspot_x;
cur_state.hot_y = hotspot_y;
- _ms_buf = buf;
+
+ if (_ms_buf)
+ free(_ms_buf);
+ _ms_buf = malloc(w * h);
+ memcpy(_ms_buf, buf, w * h);
if (_mouse_state_changed == false) {
undraw_mouse();
}
+ _mouseKeycolor = keycolor;
_mouse_state_changed = true;
}
More information about the Scummvm-git-logs
mailing list