From a401f0a19e09d7d00a3ee94d928db82e658b7b48 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 3 Jun 2012 02:02:57 +0200 Subject: ALL: Replace cursorTargetScale in OSystem API with a simple "do not scale" logic. All uses of the old target scale API actually wanted to disallow scaling of the mouse cursor. This commit adapts our API to this and thus simplifies backend implementations. Some backends, most notable the Wii and Android, did some implementation of the cursor target scale, which I didn't adapt yet. I added a TODO for the porters there. --- graphics/cursorman.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'graphics/cursorman.cpp') diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp index 425714ea34..825b5c2e19 100644 --- a/graphics/cursorman.cpp +++ b/graphics/cursorman.cpp @@ -55,14 +55,14 @@ bool CursorManager::showMouse(bool visible) { return g_system->showMouse(visible); } -void CursorManager::pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, const Graphics::PixelFormat *format) { - Cursor *cur = new Cursor(buf, w, h, hotspotX, hotspotY, keycolor, targetScale, format); +void CursorManager::pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { + Cursor *cur = new Cursor(buf, w, h, hotspotX, hotspotY, keycolor, dontScale, format); cur->_visible = isVisible(); _cursorStack.push(cur); if (buf) { - g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale, format); + g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, dontScale, format); } } @@ -75,7 +75,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->_dontScale, &cur->_format); } g_system->showMouse(isVisible()); @@ -98,10 +98,10 @@ void CursorManager::popAllCursors() { g_system->showMouse(isVisible()); } -void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, const Graphics::PixelFormat *format) { +void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { if (_cursorStack.empty()) { - pushCursor(buf, w, h, hotspotX, hotspotY, keycolor, targetScale, format); + pushCursor(buf, w, h, hotspotX, hotspotY, keycolor, dontScale, format); return; } @@ -131,7 +131,7 @@ void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, cur->_hotspotX = hotspotX; cur->_hotspotY = hotspotY; cur->_keycolor = keycolor; - cur->_targetScale = targetScale; + cur->_dontScale = dontScale; #ifdef USE_RGB_COLOR if (format) cur->_format = *format; @@ -139,7 +139,7 @@ void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, cur->_format = Graphics::PixelFormat::createFormatCLUT8(); #endif - g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale, format); + g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, dontScale, format); } bool CursorManager::supportsCursorPalettes() { @@ -225,7 +225,7 @@ void CursorManager::replaceCursorPalette(const byte *colors, uint start, uint nu } } -CursorManager::Cursor::Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, const Graphics::PixelFormat *format) { +CursorManager::Cursor::Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { #ifdef USE_RGB_COLOR if (!format) _format = Graphics::PixelFormat::createFormatCLUT8(); @@ -245,7 +245,7 @@ CursorManager::Cursor::Cursor(const byte *data, uint w, uint h, int hotspotX, in _height = h; _hotspotX = hotspotX; _hotspotY = hotspotY; - _targetScale = targetScale; + _dontScale = dontScale; } CursorManager::Cursor::~Cursor() { -- cgit v1.2.3