aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/cursorman.cpp7
-rw-r--r--graphics/cursorman.h18
2 files changed, 13 insertions, 12 deletions
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp
index 08a0b3bb88..9559b59d4a 100644
--- a/graphics/cursorman.cpp
+++ b/graphics/cursorman.cpp
@@ -77,7 +77,7 @@ void CursorManager::popCursor() {
if (!_cursorStack.empty()) {
cur = _cursorStack.top();
- g_system->setMouseCursor(cur->_data, cur->_width, cur->_height, cur->_hotspotX, cur->_hotspotY, cur->_keycolor, cur->_targetScale, cur->_format);
+ g_system->setMouseCursor(cur->_data, cur->_width, cur->_height, cur->_hotspotX, cur->_hotspotY, cur->_keycolor, cur->_targetScale, &cur->_format);
}
g_system->showMouse(isVisible());
@@ -135,7 +135,10 @@ void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX,
cur->_keycolor = keycolor;
cur->_targetScale = targetScale;
#ifdef ENABLE_RGB_COLOR
- cur->_format = format;
+ if (format)
+ cur->_format = *format;
+ else
+ cur->_format = Graphics::PixelFormat::createFormatCLUT8();
#endif
g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale, format);
diff --git a/graphics/cursorman.h b/graphics/cursorman.h
index b744109b61..ab87c9b095 100644
--- a/graphics/cursorman.h
+++ b/graphics/cursorman.h
@@ -148,22 +148,20 @@ private:
int _hotspotX;
int _hotspotY;
uint32 _keycolor;
- const Graphics::PixelFormat *_format;
+ Graphics::PixelFormat _format;
byte _targetScale;
uint _size;
Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, const Graphics::PixelFormat *format = NULL) {
#ifdef ENABLE_RGB_COLOR
- if (!format) {
- _size = w * h;
- _keycolor &= 0xFF;
- } else {
- _size = w * h * format->bytesPerPixel;
- _keycolor &= ((1 << (format->bytesPerPixel << 3)) - 1);
- }
- _format = format;
+ if (!format)
+ _format = Graphics::PixelFormat::createFormatCLUT8();
+ else
+ _format = *format;
+ _size = w * h * _format.bytesPerPixel;
+ _keycolor &= ((1 << (_format.bytesPerPixel << 3)) - 1);
#else
- _format = NULL;
+ _format = Graphics::PixelFormat::createFormatCLUT8();
_size = w * h;
_keycolor &= 0xFF;
#endif