aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorJody Northup2009-06-13 10:24:52 +0000
committerJody Northup2009-06-13 10:24:52 +0000
commit350dc4290fd5dd8f28af9e63713b48ef2c131f09 (patch)
treeaf86a10ccd48c275b362ca0407ddfd16180a8c0c /backends
parent2ee51a8fa189fc7817fd6d78533664ec870fca48 (diff)
downloadscummvm-rg350-350dc4290fd5dd8f28af9e63713b48ef2c131f09.tar.gz
scummvm-rg350-350dc4290fd5dd8f28af9e63713b48ef2c131f09.tar.bz2
scummvm-rg350-350dc4290fd5dd8f28af9e63713b48ef2c131f09.zip
Fixed cursor code to keep track of cursor formats so that ThemeEngine and/or GuiManager cursors will render properly over the game (on spacebar hit, for instance)
svn-id: r41491
Diffstat (limited to 'backends')
-rw-r--r--backends/platform/sdl/graphics.cpp24
-rw-r--r--backends/platform/sdl/sdl.h2
2 files changed, 18 insertions, 8 deletions
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp
index e5d8ba4fbc..0d1b3fb8aa 100644
--- a/backends/platform/sdl/graphics.cpp
+++ b/backends/platform/sdl/graphics.cpp
@@ -1249,10 +1249,18 @@ void OSystem_SDL::setCursorPalette(const byte *colors, uint start, uint num) {
}
_cursorPaletteDisabled = false;
+#ifdef ENABLE_16BIT
+}
- blitCursor();
+void OSystem_SDL::setCursorFormat(Graphics::PixelFormat format) {
+ assert(format.bytesPerPixel);
+ _cursorFormat = format;
+
+#endif
+// blitCursor();
}
+
void OSystem_SDL::setShakePos(int shake_pos) {
assert (_transactionMode == kTransactionNone);
@@ -1459,7 +1467,7 @@ void OSystem_SDL::warpMouse(int x, int y) {
#ifdef ENABLE_16BIT
void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale) {
- keycolor &= (1 << (_screenFormat.bytesPerPixel << 3)) - 1;
+ keycolor &= (1 << (_cursorFormat.bytesPerPixel << 3)) - 1;
#else
void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor, int cursorTargetScale) {
#endif
@@ -1498,8 +1506,8 @@ void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x,
free(_mouseData);
#ifdef ENABLE_16BIT
- _mouseData = (byte *)malloc(w * h * _screenFormat.bytesPerPixel);
- memcpy(_mouseData, buf, w * h * _screenFormat.bytesPerPixel);
+ _mouseData = (byte *)malloc(w * h * _cursorFormat.bytesPerPixel);
+ memcpy(_mouseData, buf, w * h * _cursorFormat.bytesPerPixel);
#else
_mouseData = (byte *)malloc(w * h);
memcpy(_mouseData, buf, w * h);
@@ -1513,7 +1521,7 @@ void OSystem_SDL::blitCursor() {
const byte *srcPtr = _mouseData;
#ifdef ENABLE_16BIT
uint32 color;
- uint32 colormask = (1 << (_screenFormat.bytesPerPixel << 3)) - 1;
+ uint32 colormask = (1 << (_cursorFormat.bytesPerPixel << 3)) - 1;
#else
byte color;
#endif
@@ -1551,16 +1559,16 @@ void OSystem_SDL::blitCursor() {
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
#ifdef ENABLE_16BIT
- if (_screenFormat.bytesPerPixel > 1) {
+ if (_cursorFormat.bytesPerPixel > 1) {
color = (*(uint32 *) srcPtr) & colormask;
if (color != _mouseKeyColor) { // transparent, don't draw
uint8 r,g,b;
- _screenFormat.colorToRGB(color,r,g,b);
+ _cursorFormat.colorToRGB(color,r,g,b);
*(uint16 *)dstPtr = SDL_MapRGB(_mouseOrigSurface->format,
r, g, b);
}
dstPtr += 2;
- srcPtr += _screenFormat.bytesPerPixel;
+ srcPtr += _cursorFormat.bytesPerPixel;
} else {
#endif
color = *srcPtr;
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 69b85c7959..a25f697c80 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -130,6 +130,7 @@ public:
// Set the bitmap that's used when drawing the cursor.
#ifdef ENABLE_16BIT
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale); // overloaded by CE backend (FIXME)
+ virtual void setCursorFormat(Graphics::PixelFormat format);
#else
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, byte keycolor, int cursorTargetScale); // overloaded by CE backend (FIXME)
#endif
@@ -250,6 +251,7 @@ protected:
SDL_Surface *_screen;
#ifdef ENABLE_16BIT
Graphics::PixelFormat _screenFormat;
+ Graphics::PixelFormat _cursorFormat;
#endif
// temporary screen (for scalers)