From a401f0a19e09d7d00a3ee94d928db82e658b7b48 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 3 Jun 2012 02:02:57 +0200 Subject: [PATCH] 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. --- backends/graphics/graphics.h | 2 +- backends/graphics/null/null-graphics.h | 2 +- backends/graphics/opengl/opengl-graphics.cpp | 52 +- backends/graphics/opengl/opengl-graphics.h | 4 +- .../surfacesdl/surfacesdl-graphics.cpp | 98 +- .../graphics/surfacesdl/surfacesdl-graphics.h | 4 +- .../graphics/wincesdl/wincesdl-graphics.cpp | 2 +- .../graphics/wincesdl/wincesdl-graphics.h | 2 +- backends/modular-backend.cpp | 4 +- backends/modular-backend.h | 2 +- backends/platform/android/android.h | 2 +- backends/platform/android/gfx.cpp | 7 +- backends/platform/dc/dc.h | 2 +- backends/platform/dc/display.cpp | 2 +- .../platform/ds/arm9/source/osystem_ds.cpp | 6 +- backends/platform/ds/arm9/source/osystem_ds.h | 2 +- backends/platform/iphone/osys_main.h | 2 +- backends/platform/iphone/osys_video.mm | 4 +- backends/platform/n64/osys_n64.h | 2 +- backends/platform/n64/osys_n64_base.cpp | 2 +- backends/platform/ps2/systemps2.cpp | 2 +- backends/platform/ps2/systemps2.h | 2 +- backends/platform/psp/osys_psp.cpp | 6 +- backends/platform/psp/osys_psp.h | 2 +- backends/platform/wii/osystem.h | 2 +- backends/platform/wii/osystem_gfx.cpp | 5 +- common/system.h | 5 +- engines/gob/draw_v1.cpp | 2 +- engines/gob/draw_v2.cpp | 2 +- engines/groovie/cursor.cpp | 2 +- engines/lastexpress/data/cursor.cpp | 2 +- engines/mohawk/cursors.cpp | 2 +- engines/scumm/cursor.cpp | 4 +- graphics/cursorman.cpp | 20 +- graphics/cursorman.h | 14 +- gui/ThemeEngine.cpp | 7 +- gui/ThemeEngine.h | 6 +- gui/ThemeParser.cpp | 7 +- gui/ThemeParser.h | 1 - gui/themes/default.inc | 1890 ++++++++--------- gui/themes/scummclassic.zip | Bin 93390 -> 93390 bytes gui/themes/scummclassic/THEMERC | 2 +- gui/themes/scummmodern.zip | Bin 1449894 -> 1449870 bytes gui/themes/scummmodern/THEMERC | 2 +- gui/themes/scummmodern/scummmodern_gfx.stx | 4 +- 45 files changed, 1086 insertions(+), 1108 deletions(-) diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h index 3f282df587c..0d6fa304185 100644 --- a/backends/graphics/graphics.h +++ b/backends/graphics/graphics.h @@ -80,7 +80,7 @@ public: virtual bool showMouse(bool visible) = 0; virtual void warpMouse(int x, int y) = 0; - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) = 0; + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) = 0; virtual void setCursorPalette(const byte *colors, uint start, uint num) = 0; virtual void displayMessageOnOSD(const char *msg) {} diff --git a/backends/graphics/null/null-graphics.h b/backends/graphics/null/null-graphics.h index 2e6b24d1476..2f8baae3e8b 100644 --- a/backends/graphics/null/null-graphics.h +++ b/backends/graphics/null/null-graphics.h @@ -78,7 +78,7 @@ public: bool showMouse(bool visible) { return !visible; } void warpMouse(int x, int y) {} - void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) {} + void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) {} void setCursorPalette(const byte *colors, uint start, uint num) {} }; diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index cd820ae3b20..84490489971 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -49,7 +49,7 @@ OpenGLGraphicsManager::OpenGLGraphicsManager() _transactionMode(kTransactionNone), _cursorNeedsRedraw(false), _cursorPaletteDisabled(true), _cursorVisible(false), _cursorKeyColor(0), - _cursorTargetScale(1), + _cursorDontScale(false), _formatBGR(false), _displayX(0), _displayY(0), _displayWidth(0), _displayHeight(0) { @@ -591,7 +591,7 @@ void OpenGLGraphicsManager::warpMouse(int x, int y) { setInternalMousePosition(scaledX, scaledY); } -void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { +void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { #ifdef USE_RGB_COLOR if (format) _cursorFormat = *format; @@ -616,7 +616,7 @@ void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int _cursorState.hotX = hotspotX; _cursorState.hotY = hotspotY; _cursorKeyColor = keycolor; - _cursorTargetScale = cursorTargetScale; + _cursorDontScale = dontScale; _cursorNeedsRedraw = true; refreshCursorScale(); @@ -829,28 +829,19 @@ void OpenGLGraphicsManager::refreshCursor() { } void OpenGLGraphicsManager::refreshCursorScale() { - // Calculate the scale factors of the screen. We limit ourselves to 3 at - // most here to avoid really big (and ugly) cursors for big resolutions. - // It might be noteworthy that 3 is the (current) target scale for the - // modern theme and thus assures the cursor is *never* scaled. + // Calculate the scale factors of the screen. // We also totally ignore the aspect of the overlay cursor, since aspect // ratio correction only applies to the game screen. - uint screenScaleFactorX = MIN(30000, _videoMode.hardwareWidth * 10000 / _videoMode.screenWidth); - uint screenScaleFactorY = MIN(30000, _videoMode.hardwareHeight * 10000 / _videoMode.screenHeight); + // TODO: It might make sense to always ignore scaling of the mouse cursor + // when the overlay is visible. + uint screenScaleFactorX = _videoMode.hardwareWidth * 10000 / _videoMode.screenWidth; + uint screenScaleFactorY = _videoMode.hardwareHeight * 10000 / _videoMode.screenHeight; - // Apply the target scale factor to the cursor. - // It might be noteworthy we only apply any scaling to the cursor in case - // the current scale factor is bigger than the target scale to match - // SurfaceSdlGraphicsManager's behavior. Otherwise we would downscale the - // GUI cursor of the modern theme for example. - if (screenScaleFactorX > uint(_cursorTargetScale * 10000)) - screenScaleFactorX /= _cursorTargetScale; - else + // Ignore scaling when the cursor should not be scaled. + if (_cursorDontScale) { screenScaleFactorX = 10000; - if (screenScaleFactorY > uint(_cursorTargetScale * 10000)) - screenScaleFactorY /= _cursorTargetScale; - else screenScaleFactorY = 10000; + } // Apply them (without any possible) aspect ratio correction to the // overlay. @@ -859,16 +850,19 @@ void OpenGLGraphicsManager::refreshCursorScale() { _cursorState.rHotX = (int16)(_cursorState.hotX * screenScaleFactorX / 10000); _cursorState.rHotY = (int16)(_cursorState.hotY * screenScaleFactorY / 10000); - // Make sure we properly scale the cursor according to the desired aspect. - // It might be noteworthy that, unlike with the overlay, we do not limit - // the scale factor here to avoid odd looks if the game uses items as - // mouse cursor, which would otherwise suddenly be smaller. - int width, height; - calculateDisplaySize(width, height); - screenScaleFactorX = (width * 10000 / _videoMode.screenWidth) / _cursorTargetScale; - screenScaleFactorY = (height * 10000 / _videoMode.screenHeight) / _cursorTargetScale; + // Only apply scaling when it's desired. + if (_cursorDontScale) { + screenScaleFactorX = 10000; + screenScaleFactorY = 10000; + } else { + // Make sure we properly scale the cursor according to the desired aspect. + int width, height; + calculateDisplaySize(width, height); + screenScaleFactorX = (width * 10000 / _videoMode.screenWidth); + screenScaleFactorY = (height * 10000 / _videoMode.screenHeight); + } - // Always scale the cursor for the game. + // Apply the scale cursor scaling for the game screen. _cursorState.vW = (int16)(_cursorState.w * screenScaleFactorX / 10000); _cursorState.vH = (int16)(_cursorState.h * screenScaleFactorY / 10000); _cursorState.vHotX = (int16)(_cursorState.hotX * screenScaleFactorX / 10000); diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index ad8765bab13..956722c08fe 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -104,7 +104,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL); + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL); virtual void setCursorPalette(const byte *colors, uint start, uint num); virtual void displayMessageOnOSD(const char *msg); @@ -283,7 +283,7 @@ protected: MousePos _cursorState; bool _cursorVisible; uint32 _cursorKeyColor; - int _cursorTargetScale; + bool _cursorDontScale; bool _cursorNeedsRedraw; /** diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index e841ecb8349..652c08dc45b 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -63,17 +63,12 @@ static const OSystem::GraphicsMode s_supportedGraphicsModes[] = { DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Normal (no scaling)", "lowres") -// Table of relative scalers magnitudes -// [definedScale - 1][scaleFactor - 1] -static ScalerProc *scalersMagn[3][3] = { +// Table of the cursor scalers [scaleFactor - 1] +static ScalerProc *scalersMagn[3] = { #ifdef USE_SCALERS - { Normal1x, AdvMame2x, AdvMame3x }, - { Normal1x, Normal1x, Normal1o5x }, - { Normal1x, Normal1x, Normal1x } + Normal1x, AdvMame2x, AdvMame3x #else // remove dependencies on other scalers - { Normal1x, Normal1x, Normal1x }, - { Normal1x, Normal1x, Normal1x }, - { Normal1x, Normal1x, Normal1x } + Normal1x, Normal1x, Normal1x #endif }; @@ -135,7 +130,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou _overlayscreen(0), _tmpscreen2(0), _scalerProc(0), _screenChangeCount(0), _mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0), - _mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true), + _mouseOrigSurface(0), _cursorDontScale(false), _cursorPaletteDisabled(true), _currentShakePos(0), _newShakePos(0), _paletteDirtyStart(0), _paletteDirtyEnd(0), _screenIsLocked(false), @@ -1718,7 +1713,7 @@ void SurfaceSdlGraphicsManager::warpMouse(int x, int y) { } } -void SurfaceSdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { +void SurfaceSdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { #ifdef USE_RGB_COLOR if (!format) _cursorFormat = Graphics::PixelFormat::createFormatCLUT8(); @@ -1739,7 +1734,7 @@ void SurfaceSdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, _mouseKeyColor = keycolor; - _cursorTargetScale = cursorTargetScale; + _cursorDontScale = dontScale; if (_mouseCurState.w != (int)w || _mouseCurState.h != (int)h) { _mouseCurState.w = w; @@ -1847,51 +1842,34 @@ void SurfaceSdlGraphicsManager::blitCursor() { } int rW, rH; + int cursorScale; - if (_cursorTargetScale >= _videoMode.scaleFactor) { - // The cursor target scale is greater or equal to the scale at - // which the rest of the screen is drawn. We do not downscale - // the cursor image, we draw it at its original size. It will - // appear too large on screen. - - rW = w; - rH = h; - _mouseCurState.rHotX = _mouseCurState.hotX; - _mouseCurState.rHotY = _mouseCurState.hotY; - - // The virtual dimensions may be larger than the original. - - _mouseCurState.vW = w * _cursorTargetScale / _videoMode.scaleFactor; - _mouseCurState.vH = h * _cursorTargetScale / _videoMode.scaleFactor; - _mouseCurState.vHotX = _mouseCurState.hotX * _cursorTargetScale / - _videoMode.scaleFactor; - _mouseCurState.vHotY = _mouseCurState.hotY * _cursorTargetScale / - _videoMode.scaleFactor; + if (_cursorDontScale) { + // Don't scale the cursor at all if the user requests this behavior. + cursorScale = 1; } else { - // The cursor target scale is smaller than the scale at which - // the rest of the screen is drawn. We scale up the cursor - // image to make it appear correct. - - rW = w * _videoMode.scaleFactor / _cursorTargetScale; - rH = h * _videoMode.scaleFactor / _cursorTargetScale; - _mouseCurState.rHotX = _mouseCurState.hotX * _videoMode.scaleFactor / - _cursorTargetScale; - _mouseCurState.rHotY = _mouseCurState.hotY * _videoMode.scaleFactor / - _cursorTargetScale; - - // The virtual dimensions will be the same as the original. - - _mouseCurState.vW = w; - _mouseCurState.vH = h; - _mouseCurState.vHotX = _mouseCurState.hotX; - _mouseCurState.vHotY = _mouseCurState.hotY; + // Scale the cursor with the game screen scale factor. + cursorScale = _videoMode.scaleFactor; } + // Adapt the real hotspot according to the scale factor. + rW = w * cursorScale; + rH = h * cursorScale; + _mouseCurState.rHotX = _mouseCurState.hotX * cursorScale; + _mouseCurState.rHotY = _mouseCurState.hotY * cursorScale; + + // The virtual dimensions will be the same as the original. + + _mouseCurState.vW = w; + _mouseCurState.vH = h; + _mouseCurState.vHotX = _mouseCurState.hotX; + _mouseCurState.vHotY = _mouseCurState.hotY; + #ifdef USE_SCALERS int rH1 = rH; // store original to pass to aspect-correction function later #endif - if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1) { + if (!_cursorDontScale && _videoMode.aspectRatioCorrection) { rH = real2Aspect(rH - 1) + 1; _mouseCurState.rHotY = real2Aspect(_mouseCurState.rHotY); } @@ -1922,21 +1900,25 @@ void SurfaceSdlGraphicsManager::blitCursor() { ScalerProc *scalerProc; - // If possible, use the same scaler for the cursor as for the rest of - // the game. This only works well with the non-blurring scalers so we - // actually only use the 1x, 1.5x, 2x and AdvMame scalers. - - if (_cursorTargetScale == 1 && (_videoMode.mode == GFX_DOUBLESIZE || _videoMode.mode == GFX_TRIPLESIZE)) - scalerProc = _scalerProc; - else - scalerProc = scalersMagn[_cursorTargetScale - 1][_videoMode.scaleFactor - 1]; + // Only apply scaling, when the user allows it. + if (!_cursorDontScale) { + // If possible, use the same scaler for the cursor as for the rest of + // the game. This only works well with the non-blurring scalers so we + // actually only use the 1x, 2x and AdvMame scalers. + if (_videoMode.mode == GFX_DOUBLESIZE || _videoMode.mode == GFX_TRIPLESIZE) + scalerProc = _scalerProc; + else + scalerProc = scalersMagn[_videoMode.scaleFactor - 1]; + } else { + scalerProc = Normal1x; + } scalerProc((byte *)_mouseOrigSurface->pixels + _mouseOrigSurface->pitch + 2, _mouseOrigSurface->pitch, (byte *)_mouseSurface->pixels, _mouseSurface->pitch, _mouseCurState.w, _mouseCurState.h); #ifdef USE_SCALERS - if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1) + if (!_cursorDontScale && _videoMode.aspectRatioCorrection) cursorStretch200To240((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, rW, rH1, 0, 0, 0); #endif diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h index f71096d43e7..32fb219bcd1 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.h +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h @@ -131,7 +131,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL); + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL); virtual void setCursorPalette(const byte *colors, uint start, uint num); #ifdef USE_OSD @@ -281,7 +281,7 @@ protected: #else byte _mouseKeyColor; #endif - int _cursorTargetScale; + bool _cursorDontScale; bool _cursorPaletteDisabled; SDL_Surface *_mouseOrigSurface; SDL_Surface *_mouseSurface; diff --git a/backends/graphics/wincesdl/wincesdl-graphics.cpp b/backends/graphics/wincesdl/wincesdl-graphics.cpp index 58b735ef8b4..bb79813f3b1 100644 --- a/backends/graphics/wincesdl/wincesdl-graphics.cpp +++ b/backends/graphics/wincesdl/wincesdl-graphics.cpp @@ -1128,7 +1128,7 @@ void WINCESdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x SDL_UnlockSurface(_screen); } -void WINCESdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { +void WINCESdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { undrawMouse(); if (w == 0 || h == 0) diff --git a/backends/graphics/wincesdl/wincesdl-graphics.h b/backends/graphics/wincesdl/wincesdl-graphics.h index 2e8c3313b36..7cff8a16d97 100644 --- a/backends/graphics/wincesdl/wincesdl-graphics.h +++ b/backends/graphics/wincesdl/wincesdl-graphics.h @@ -73,7 +73,7 @@ public: void internDrawMouse(); void undrawMouse(); bool showMouse(bool visible); - void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); // overloaded by CE backend + void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); // overloaded by CE backend void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME) Graphics::Surface *lockScreen(); diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp index 525170d6851..f133c65ed5c 100644 --- a/backends/modular-backend.cpp +++ b/backends/modular-backend.cpp @@ -195,8 +195,8 @@ void ModularBackend::warpMouse(int x, int y) { _graphicsManager->warpMouse(x, y); } -void ModularBackend::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { - _graphicsManager->setMouseCursor(buf, w, h, hotspotX, hotspotY, keycolor, cursorTargetScale, format); +void ModularBackend::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { + _graphicsManager->setMouseCursor(buf, w, h, hotspotX, hotspotY, keycolor, dontScale, format); } void ModularBackend::setCursorPalette(const byte *colors, uint start, uint num) { diff --git a/backends/modular-backend.h b/backends/modular-backend.h index 072ee805b6d..150c12c3c8d 100644 --- a/backends/modular-backend.h +++ b/backends/modular-backend.h @@ -100,7 +100,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL); + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL); virtual void setCursorPalette(const byte *colors, uint start, uint num); //@} diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index 47a6515a2ac..4dad1ee7ed5 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -269,7 +269,7 @@ public: virtual void warpMouse(int x, int y); virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, - int cursorTargetScale, + bool dontScale, const Graphics::PixelFormat *format); virtual void setCursorPalette(const byte *colors, uint start, uint num); diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index 8bc914f5674..304031b4bae 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -687,10 +687,10 @@ bool OSystem_Android::showMouse(bool visible) { void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, - uint32 keycolor, int cursorTargetScale, + uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { ENTER("%p, %u, %u, %d, %d, %u, %d, %p", buf, w, h, hotspotX, hotspotY, - keycolor, cursorTargetScale, format); + keycolor, dontScale, format); GLTHREADCHECK; @@ -766,7 +766,8 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h, } _mouse_hotspot = Common::Point(hotspotX, hotspotY); - _mouse_targetscale = cursorTargetScale; + // TODO: Adapt to the new "do not scale" cursor logic. + _mouse_targetscale = 1; } void OSystem_Android::setCursorPaletteInternal(const byte *colors, diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index 8ca48bf19ef..ffe003ea1d8 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -142,7 +142,7 @@ public: void warpMouse(int x, int y); // Set the bitmap that's used when drawing the cursor. - void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); + void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); // Replace the specified range of cursor the palette with new colors. void setCursorPalette(const byte *colors, uint start, uint num); diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp index e886b558697..e4e9a94ec80 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -293,7 +293,7 @@ void OSystem_Dreamcast::warpMouse(int x, int y) void OSystem_Dreamcast::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, - uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) + uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { _ms_cur_w = w; _ms_cur_h = h; diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index 73340ed18a2..a6b85f207f2 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -580,7 +580,7 @@ bool OSystem_DS::showMouse(bool visible) { void OSystem_DS::warpMouse(int x, int y) { } -void OSystem_DS::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, int targetCursorScale, const Graphics::PixelFormat *format) { +void OSystem_DS::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { if ((w > 0) && (w < 64) && (h > 0) && (h < 64)) { memcpy(_cursorImage, buf, w * h); _cursorW = w; @@ -588,7 +588,9 @@ void OSystem_DS::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, i _cursorHotX = hotspotX; _cursorHotY = hotspotY; _cursorKey = keycolor; - _cursorScale = targetCursorScale; + // TODO: The old target scales was saved, but never used. Should the + // new "do not scale" logic be implemented? + //_cursorScale = targetCursorScale; refreshCursor(); } } diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 6aa37319167..11b09886668 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -114,7 +114,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, int targetCursorScale, const Graphics::PixelFormat *format); + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format); virtual bool pollEvent(Common::Event &event); virtual uint32 getMillis(); diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index b443e22f565..e06c7973ab7 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -161,7 +161,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 255, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL); + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 255, bool dontScale = false, const Graphics::PixelFormat *format = NULL); virtual void setCursorPalette(const byte *colors, uint start, uint num); virtual bool pollEvent(Common::Event &event); diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm index c6b6e6d7577..ddfa8f5030f 100644 --- a/backends/platform/iphone/osys_video.mm +++ b/backends/platform/iphone/osys_video.mm @@ -398,8 +398,8 @@ void OSystem_IPHONE::dirtyFullOverlayScreen() { } } -void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { - //printf("setMouseCursor(%p, %u, %u, %i, %i, %u, %d, %p)\n", (const void *)buf, w, h, hotspotX, hotspotY, keycolor, cursorTargetScale, (const void *)format); +void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { + //printf("setMouseCursor(%p, %u, %u, %i, %i, %u, %d, %p)\n", (const void *)buf, w, h, hotspotX, hotspotY, keycolor, dontScale, (const void *)format); const Graphics::PixelFormat pixelFormat = format ? *format : Graphics::PixelFormat::createFormatCLUT8(); #if 0 diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h index 4788beb1ca4..b8519eeea68 100644 --- a/backends/platform/n64/osys_n64.h +++ b/backends/platform/n64/osys_n64.h @@ -182,7 +182,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); virtual void setCursorPalette(const byte *colors, uint start, uint num); virtual bool pollEvent(Common::Event &event); diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp index c3adb9691c2..f36f7399e1a 100644 --- a/backends/platform/n64/osys_n64_base.cpp +++ b/backends/platform/n64/osys_n64_base.cpp @@ -773,7 +773,7 @@ void OSystem_N64::warpMouse(int x, int y) { _dirtyOffscreen = true; } -void OSystem_N64::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { +void OSystem_N64::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { if (!w || !h) return; _mouseHotspotX = hotspotX; diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index d4e993da635..668ac93a07a 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -618,7 +618,7 @@ void OSystem_PS2::warpMouse(int x, int y) { _screen->setMouseXy(x, y); } -void OSystem_PS2::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { +void OSystem_PS2::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { _screen->setMouseOverlay(buf, w, h, hotspot_x, hotspot_y, keycolor); } diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index 3a0e2477378..7bbe061e420 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -80,7 +80,7 @@ public: virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = 0); + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = 0); virtual uint32 getMillis(); virtual void delayMillis(uint msecs); diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 5fa51106848..958a3a22c6f 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -303,7 +303,7 @@ void OSystem_PSP::warpMouse(int x, int y) { _cursor.setXY(x, y); } -void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { +void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) { DEBUG_ENTER_FUNC(); _displayManager.waitUntilRenderFinished(); _pendingUpdate = false; @@ -314,7 +314,9 @@ void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, } _cursor.setKeyColor(keycolor); - _cursor.setCursorTargetScale(cursorTargetScale); + // TODO: The old target scale was saved but never used. Should the new + // "do not scale" logic be implemented? + //_cursor.setCursorTargetScale(cursorTargetScale); _cursor.setSizeAndScummvmPixelFormat(w, h, format); _cursor.setHotspot(hotspotX, hotspotY); _cursor.clearKeyColor(); diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index e6b445e232d..c72053f52cb 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -118,7 +118,7 @@ public: // Mouse related bool showMouse(bool visible); void warpMouse(int x, int y); - void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); + void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); // Events and input bool pollEvent(Common::Event &event); diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index 64197f913af..b6784d59e46 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -189,7 +189,7 @@ public: virtual void warpMouse(int x, int y); virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, - int cursorTargetScale, + bool dontScale, const Graphics::PixelFormat *format); virtual bool pollEvent(Common::Event &event); diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index 83607984cce..a00cea82522 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -644,7 +644,7 @@ void OSystem_Wii::warpMouse(int x, int y) { void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, - int cursorTargetScale, + bool dontScale, const Graphics::PixelFormat *format) { gfx_tex_format_t tex_format = GFX_TF_PALETTE_RGB5A3; uint tw, th; @@ -742,7 +742,8 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, _mouseHotspotX = hotspotX; _mouseHotspotY = hotspotY; - _cursorScale = cursorTargetScale; + // TODO: Adapt to new dontScale logic! + _cursorScale = 1; if ((_texMouse.palette) && (oldKeycolor != _mouseKeyColor)) _cursorPaletteDirty = true; diff --git a/common/system.h b/common/system.h index dc74533861d..976a3d2c4ab 100644 --- a/common/system.h +++ b/common/system.h @@ -883,10 +883,11 @@ public: * @param keycolor transparency color value. This should not exceed the maximum color value of the specified format. * In case it does the behavior is undefined. The backend might just error out or simply ignore the * value. (The SDL backend will just assert to prevent abuse of this). - * @param cursorTargetScale scale factor which cursor is designed for + * @param dontScale Whether the cursor should never be scaled. An exception are high ppi displays, where the cursor + * would be too small to notice otherwise, these are allowed to scale the cursor anyway. * @param format pointer to the pixel format which cursor graphic uses (0 means CLUT8) */ - virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) = 0; + virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) = 0; /** * Replace the specified range of cursor the palette with new colors. diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp index fb15fdbc193..878c1dc2653 100644 --- a/engines/gob/draw_v1.cpp +++ b/engines/gob/draw_v1.cpp @@ -123,7 +123,7 @@ void Draw_v1::animateCursor(int16 cursor) { (cursorIndex + 1) * _cursorWidth - 1, _cursorHeight - 1, 0, 0); CursorMan.replaceCursor(_scummvmCursor->getData(), - _cursorWidth, _cursorHeight, hotspotX, hotspotY, 0, 1, &_vm->getPixelFormat()); + _cursorWidth, _cursorHeight, hotspotX, hotspotY, 0, false, &_vm->getPixelFormat()); if (_frontSurface != _backSurface) { _showCursor = 3; diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index ab9a90de8fa..d9b7a126390 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -161,7 +161,7 @@ void Draw_v2::animateCursor(int16 cursor) { keyColor = _cursorKeyColors[cursorIndex]; CursorMan.replaceCursor(_scummvmCursor->getData(), - _cursorWidth, _cursorHeight, hotspotX, hotspotY, keyColor, 1, &_vm->getPixelFormat()); + _cursorWidth, _cursorHeight, hotspotX, hotspotY, keyColor, false, &_vm->getPixelFormat()); if (_doCursorPalettes && _doCursorPalettes[cursorIndex]) { CursorMan.replaceCursorPalette(_cursorPalettes + (cursorIndex * 256 * 3), diff --git a/engines/groovie/cursor.cpp b/engines/groovie/cursor.cpp index abefac54bd7..6422570220d 100644 --- a/engines/groovie/cursor.cpp +++ b/engines/groovie/cursor.cpp @@ -387,7 +387,7 @@ void Cursor_v2::enable() { void Cursor_v2::showFrame(uint16 frame) { int offset = _width * _height * frame * 2; - CursorMan.replaceCursor((const byte *)(_img + offset), _width, _height, _width >> 1, _height >> 1, 0, 1, &_format); + CursorMan.replaceCursor((const byte *)(_img + offset), _width, _height, _width >> 1, _height >> 1, 0, false, &_format); } diff --git a/engines/lastexpress/data/cursor.cpp b/engines/lastexpress/data/cursor.cpp index 86a66b49d9d..a3e7b773a75 100644 --- a/engines/lastexpress/data/cursor.cpp +++ b/engines/lastexpress/data/cursor.cpp @@ -93,7 +93,7 @@ void Cursor::setStyle(CursorStyle style) { Graphics::PixelFormat pf = g_system->getScreenFormat(); CursorMan.replaceCursor((const byte *)getCursorImage(style), 32, 32, _cursors[style].hotspotX, _cursors[style].hotspotY, - 0, 1, &pf); + 0, false, &pf); } const uint16 *Cursor::getCursorImage(CursorStyle style) const { diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp index 3cf5ac740e6..47a7d0225b5 100644 --- a/engines/mohawk/cursors.cpp +++ b/engines/mohawk/cursors.cpp @@ -125,7 +125,7 @@ void MystCursorManager::setCursor(uint16 id) { CursorMan.replaceCursorPalette(mhkSurface->getPalette(), 0, 256); } else { Graphics::PixelFormat pixelFormat = g_system->getScreenFormat(); - CursorMan.replaceCursor((byte *)surface->pixels, surface->w, surface->h, hotspotX, hotspotY, pixelFormat.RGBToColor(255, 255, 255), 1, &pixelFormat); + CursorMan.replaceCursor((byte *)surface->pixels, surface->w, surface->h, hotspotX, hotspotY, pixelFormat.RGBToColor(255, 255, 255), false, &pixelFormat); } _vm->_needsUpdate = true; diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index 42f11498d91..88681898f52 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -121,13 +121,13 @@ void ScummEngine::updateCursor() { CursorMan.replaceCursor(_grabbedCursor, _cursor.width, _cursor.height, _cursor.hotspotX, _cursor.hotspotY, (_game.platform == Common::kPlatformNES ? _grabbedCursor[63] : transColor), - (_game.heversion == 70 ? 2 : 1), + (_game.heversion == 70 ? true : false), &format); #else CursorMan.replaceCursor(_grabbedCursor, _cursor.width, _cursor.height, _cursor.hotspotX, _cursor.hotspotY, (_game.platform == Common::kPlatformNES ? _grabbedCursor[63] : transColor), - (_game.heversion == 70 ? 2 : 1)); + (_game.heversion == 70 ? true : false)); #endif } diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp index 425714ea348..825b5c2e19e 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() { diff --git a/graphics/cursorman.h b/graphics/cursorman.h index 543a5d0a5c3..852109d7e69 100644 --- a/graphics/cursorman.h +++ b/graphics/cursorman.h @@ -63,14 +63,15 @@ public: * @param hotspotY the hotspot Y coordinate * @param keycolor the color value for the transparent color. This may not exceed * the maximum color value as defined by format. - * @param targetScale the scale for which the cursor is designed + * @param dontScale Whether the cursor should never be scaled. An exception are high ppi displays, where the cursor + * would be too small to notice otherwise, these are allowed to scale the cursor anyway. * @param format a pointer to the pixel format which the cursor graphic uses, * CLUT8 will be used if this is NULL or not specified. * @note It is ok for the buffer to be a NULL pointer. It is sometimes * useful to push a "dummy" cursor and modify it later. The * cursor will be added to the stack, but not to the backend. */ - void pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale = 1, const Graphics::PixelFormat *format = NULL); + void pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL); /** * Pop a cursor from the stack, and restore the previous one to the @@ -90,11 +91,12 @@ public: * @param hotspotY the hotspot Y coordinate * @param keycolor the color value for the transparent color. This may not exceed * the maximum color value as defined by format. - * @param targetScale the scale for which the cursor is designed + * @param dontScale Whether the cursor should never be scaled. An exception are high ppi displays, where the cursor + * would be too small to notice otherwise, these are allowed to scale the cursor anyway. * @param format a pointer to the pixel format which the cursor graphic uses, * CLUT8 will be used if this is NULL or not specified. */ - void replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale = 1, const Graphics::PixelFormat *format = NULL); + void replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL); /** * Pop all of the cursors and cursor palettes from their respective stacks. @@ -175,11 +177,11 @@ private: int _hotspotY; uint32 _keycolor; Graphics::PixelFormat _format; - int _targetScale; + bool _dontScale; uint _size; - Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale = 1, const Graphics::PixelFormat *format = NULL); + Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL); ~Cursor(); }; diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index be0a5db601e..1bf7ad3c853 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -454,7 +454,7 @@ void ThemeEngine::refresh() { if (_useCursor) { CursorMan.replaceCursorPalette(_cursorPal, 0, _cursorPalSize); - CursorMan.replaceCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, _cursorTargetScale); + CursorMan.replaceCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, true); } } } @@ -465,7 +465,7 @@ void ThemeEngine::enable() { if (_useCursor) { CursorMan.pushCursorPalette(_cursorPal, 0, _cursorPalSize); - CursorMan.pushCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, _cursorTargetScale); + CursorMan.pushCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, true); CursorMan.showMouse(true); } @@ -1287,7 +1287,7 @@ void ThemeEngine::openDialog(bool doBuffer, ShadingStyle style) { _vectorRenderer->setSurface(&_screen); } -bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int hotspotY, int scale) { +bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int hotspotY) { if (!_system->hasFeature(OSystem::kFeatureCursorPalette)) return true; @@ -1305,7 +1305,6 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int // Set up the cursor parameters _cursorHotspotX = hotspotX; _cursorHotspotY = hotspotY; - _cursorTargetScale = scale; _cursorWidth = cursor->w; _cursorHeight = cursor->h; diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index acded085f50..67221d98ce9 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -35,7 +35,7 @@ #include "graphics/pixelformat.h" -#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.12" +#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.13" class OSystem; @@ -495,9 +495,8 @@ public: * @param filename File name of the bitmap to load. * @param hotspotX X Coordinate of the bitmap which does the cursor click. * @param hotspotY Y Coordinate of the bitmap which does the cursor click. - * @param scale Scale at which the bitmap is supposed to be used. */ - bool createCursor(const Common::String &filename, int hotspotX, int hotspotY, int scale); + bool createCursor(const Common::String &filename, int hotspotX, int hotspotY); /** * Wrapper for restoring data from the Back Buffer to the screen. @@ -669,7 +668,6 @@ protected: bool _useCursor; int _cursorHotspotX, _cursorHotspotY; - int _cursorTargetScale; enum { MAX_CURS_COLORS = 255 }; diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index 9ccdedd5645..9a85399ed1b 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -218,15 +218,12 @@ bool ThemeParser::parserCallback_cursor(ParserNode *node) { return true; } - int spotx, spoty, scale; + int spotx, spoty; if (!parseIntegerKey(node->values["hotspot"], 2, &spotx, &spoty)) return parserError("Error parsing cursor Hot Spot coordinates."); - if (!parseIntegerKey(node->values["scale"], 1, &scale)) - return parserError("Error parsing cursor scale."); - - if (!_theme->createCursor(node->values["file"], spotx, spoty, scale)) + if (!_theme->createCursor(node->values["file"], spotx, spoty)) return parserError("Error creating Bitmap Cursor."); return true; diff --git a/gui/ThemeParser.h b/gui/ThemeParser.h index 4b7e88cbf37..82f774b8030 100644 --- a/gui/ThemeParser.h +++ b/gui/ThemeParser.h @@ -85,7 +85,6 @@ protected: XML_KEY(cursor) XML_PROP(file, true) XML_PROP(hotspot, true) - XML_PROP(scale, true) XML_PROP(resolution, false) KEY_END() diff --git a/gui/themes/default.inc b/gui/themes/default.inc index 5ee9b9202a7..86d0061e1b6 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -610,951 +610,6 @@ "/> " " " " " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " " " " " " " @@ -2500,3 +1555,948 @@ " " " " " " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip index ec1728b77873a9fc389e9eecd3cbd10f97d91740..d126ed077409aa9ba62cc76f6262a7eb849a09e9 100644 GIT binary patch delta 467 zcmX?ill9z9R-piIW)=|!5ct4z*x{*?_Unm4DvZVx&2^ZUu29?FD$2N*56r5IVqD43 z1yiiIbz|xzYp?{XF{2YVnB}ShQhc?icJqW4pK`!LPF{?b0$`zE){`MZUUrOcxrG>+ zM3_u7iSX`W$9G{+6p;uf|5#Wum7Gx~zHf|>Y zZUzPr7Dq8QF^XaO#0fZ${G^UkIp1(qR zx?DCR4_L2#4x=LFgn`F(LpH;Pa$;Zh# zU`BDtryS-@Oi3Hl_VRH6X@|Djw9^x_WhZ;^^KG0qm1A>7-Vaugg3WnRPTU~IcB?qX zx7^$?Yd}&N4=n}2YSj2w@(VFCi7=x&VY+1&qb|_?=^wHfWtbuvrt@Vp$|?Ze;lOH| z|1~X#fdPbtz|MvcOB&x=Pmj-GQ~;|w;Pn2+KA;K^mPAq2ykh#5Y({mE<7^Rsj zL>Z^IXE7?n{W3i-i&2c(LWObq#B4@outL3Tpu!(UjFao4B&N^HV&qW(YIi8#(QxuG zHv>8G<8C8zJoVH5!X DUxIb~ diff --git a/gui/themes/scummclassic/THEMERC b/gui/themes/scummclassic/THEMERC index 7cbed97e409..d4bed29cf8e 100644 --- a/gui/themes/scummclassic/THEMERC +++ b/gui/themes/scummclassic/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.12:ScummVM Classic Theme:No Author] +[SCUMMVM_STX0.8.13:ScummVM Classic Theme:No Author] diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip index deae315e30350c6d428e79c99c0d0b3b9068e8f2..db116325e23dc26cce2a6293295d693a5671fe5d 100644 GIT binary patch delta 1104 zcmZvaZAep57{|{%b8d6G&D|Z{-L5ZeMESBT^Brp%p zNu5kT^r19@AidQ^LKMsoA_QR(L5N2A$uEJgVAMJ1Dzs?hH}1|o&;NOz|MLuvm)sdI ziEtM{B?stdSvTpL-kfObiEt=VdeRf%@W>8vMl}`=KXo-qA@i-kOYLvpnBU` z+-gBd^eRr^kyTSdOt0`2r8VGO0SPn|+hULvM(F|0ib3(Q)a~4;pQS1Y0L9GaB>y~V zO=`s53tS|=8I711*dvf&ZwtW90|R1QE&Tl)3&HCKy-5! zzqcShE?|CShNgg9iJt*}9gSk?9I?kr(%w%{;ASg|WZm_V6Wxka0ld`>Rh6j?8TdHq z*G1cjZyCzo&a4m6%*s-LI!|S_zx;B2y}#C3UUSi1pa|liyq#nzaKDXYs>xB{Q5zEC zsN7w9iZ_jPK+y)s!BG|dz;6}gC+VSQN`-Ip$eu+5&)yrpnij4A6m>vg+(#92>)!%s z6ka0Uz{YPOSi_^3I8u{KoO&bf91H>!Lx7O@BLwG?LYXB3osFhTi<5n(NPLb*I(a}# zJP|xJpv4;N*3B=p$-c*0ykA*@R2pl#%}%1D$5orw|=K@mDchLR}JAKaqW z>N{yzU{)j6Wmss=#Tx!Yw-0JVFe8ZVF+H9$5`=3^5 zqb*q^__S@LireSWoE$jq{}lU@2&^O|kg9mN&0_S#ni_(#r^GXL&cUHK%SQiC8Q&f% zr;&9DrKsP2H_W5dWK&*P$GcH77^|aMzeRwx4mMLQ3hyN*d1_FgrZsZY`o>6`w=uLK zuv8FjR1=Qt1Qr*Q=q^gY>tb#`DI9gMeDS6pt~gjh7B8{0z2zR9a4;rrvqSqG{Wv%& zF-*tCv5SMpRF9G93y-C4lJ^69%31j0CudeSwX<-5zi ziKH?r%he6xm^U788NGe103IjODxT#)sq+`jj5PYF)(YP7Y?6A>UVgPTXod5xUnlD& zJgM4hh20XHq-p&aWpL6iD+xwgBY$s6)p-EjKd|`Xkrj_Gp9b} HU|8oT97jpF diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC index 326993e98d1..60744d386f0 100644 --- a/gui/themes/scummmodern/THEMERC +++ b/gui/themes/scummmodern/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.12:ScummVM Modern Theme:No Author] +[SCUMMVM_STX0.8.13:ScummVM Modern Theme:No Author] diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx index 970d78a5aeb..037c3272351 100644 --- a/gui/themes/scummmodern/scummmodern_gfx.stx +++ b/gui/themes/scummmodern/scummmodern_gfx.stx @@ -187,8 +187,8 @@ - - + +