aboutsummaryrefslogtreecommitdiff
path: root/graphics/cursorman.cpp
diff options
context:
space:
mode:
authorJody Northup2009-06-05 08:09:37 +0000
committerJody Northup2009-06-05 08:09:37 +0000
commit9789ba7f28d2c0a093adda01435306f28e91fede (patch)
treeced66d59e1c0b16a59ca36196159378b871d4333 /graphics/cursorman.cpp
parent662a305752214564a9db0ac2d61594367067efa1 (diff)
downloadscummvm-rg350-9789ba7f28d2c0a093adda01435306f28e91fede.tar.gz
scummvm-rg350-9789ba7f28d2c0a093adda01435306f28e91fede.tar.bz2
scummvm-rg350-9789ba7f28d2c0a093adda01435306f28e91fede.zip
Corrected backend to be able to accept a 16-bit mouseKeyColor without overflow
svn-id: r41194
Diffstat (limited to 'graphics/cursorman.cpp')
-rw-r--r--graphics/cursorman.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp
index f303749572..84578a3911 100644
--- a/graphics/cursorman.cpp
+++ b/graphics/cursorman.cpp
@@ -100,6 +100,37 @@ void CursorManager::popAllCursors() {
g_system->showMouse(isVisible());
}
+#ifdef ENABLE_16BIT
+//HACK Made a separate method to avoid massive linker errors on every engine
+void CursorManager::replaceCursor16(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint16 keycolor, int targetScale) {
+ if (_cursorStack.empty()) {
+ pushCursor(buf, w, h, hotspotX, hotspotY, keycolor, targetScale);
+ return;
+ }
+
+ Cursor *cur = _cursorStack.top();
+
+ uint size = w * h * 2;
+
+ if (cur->_size < size) {
+ delete[] cur->_data;
+ cur->_data = new byte[size];
+ cur->_size = size;
+ }
+
+ if (buf && cur->_data)
+ memcpy(cur->_data, buf, size);
+
+ cur->_width = w;
+ cur->_height = h;
+ cur->_hotspotX = hotspotX;
+ cur->_hotspotY = hotspotY;
+ cur->_keycolor = keycolor;
+ cur->_targetScale = targetScale;
+
+ g_system->setMouseCursor16(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale);
+}
+#endif
void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int targetScale) {
if (_cursorStack.empty()) {
@@ -108,11 +139,8 @@ void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX,
}
Cursor *cur = _cursorStack.top();
-#ifdef ENABLE_16BIT
- uint size = w * h * 2;
-#else
+
uint size = w * h;
-#endif
if (cur->_size < size) {
delete[] cur->_data;