aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl
diff options
context:
space:
mode:
authorJody Northup2009-06-05 06:41:04 +0000
committerJody Northup2009-06-05 06:41:04 +0000
commitf8361b5c53b96faddb56024bb932ce46b7005dbf (patch)
tree54235722ffac47e02e855778f129a9665481a00d /backends/platform/sdl
parent1f43d9b860b9c1a6d5e62cc261ff5da94b42d50e (diff)
downloadscummvm-rg350-f8361b5c53b96faddb56024bb932ce46b7005dbf.tar.gz
scummvm-rg350-f8361b5c53b96faddb56024bb932ce46b7005dbf.tar.bz2
scummvm-rg350-f8361b5c53b96faddb56024bb932ce46b7005dbf.zip
Converted cursor code to use 16-bit.
svn-id: r41191
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r--backends/platform/sdl/graphics.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp
index 389a7a0735..1a80b9be19 100644
--- a/backends/platform/sdl/graphics.cpp
+++ b/backends/platform/sdl/graphics.cpp
@@ -1438,8 +1438,13 @@ void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x,
free(_mouseData);
+#ifdef ENABLE_16BIT
+ _mouseData = (byte *)malloc(w * h * 2);
+ memcpy(_mouseData, buf, w * h * 2);
+#else
_mouseData = (byte *)malloc(w * h);
memcpy(_mouseData, buf, w * h);
+#endif
blitCursor();
}
@@ -1481,12 +1486,24 @@ void OSystem_SDL::blitCursor() {
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
color = *srcPtr;
+#ifdef ENABLE_16BIT
+ if (color != _mouseKeyColor) { // transparent, don't draw
+ int8 r = ((*(uint16 *)srcPtr >> 10) & 0x1F) << 3;
+ int8 g = ((*(uint16 *)srcPtr >> 5) & 0x1F) << 3;
+ int8 b = (*(uint16 *)srcPtr & 0x1F) << 3;
+ *(uint16 *)dstPtr = SDL_MapRGB(_mouseOrigSurface->format,
+ r, g, b);
+ }
+ dstPtr += 2;
+ srcPtr += 2;
+#else
if (color != _mouseKeyColor) { // transparent, don't draw
*(uint16 *)dstPtr = SDL_MapRGB(_mouseOrigSurface->format,
palette[color].r, palette[color].g, palette[color].b);
}
dstPtr += 2;
srcPtr++;
+#endif
}
dstPtr += _mouseOrigSurface->pitch - w * 2;
}