[Scummvm-git-logs] scummvm master -> 641e3d987e70009cb6b3d02fbb431ad00fc9ef0f
sev-
noreply at scummvm.org
Sat Jul 4 16:10:56 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
641e3d987e SDL: Fix game cursor position at scale factors above 1x
Commit: 641e3d987e70009cb6b3d02fbb431ad00fc9ef0f
https://github.com/scummvm/scummvm/commit/641e3d987e70009cb6b3d02fbb431ad00fc9ef0f
Author: Ion Andrei Cristian (lecturatul2017 at gmail.com)
Date: 2026-07-04T18:10:51+02:00
Commit Message:
SDL: Fix game cursor position at scale factors above 1x
Commit 925c8d3e1fa dropped the !_overlayInGUI branch in undrawMouse()
and always subtracts the scaled hotspot (rHotX) from the virtual cursor
coordinates. drawMouse() then multiplies the rect by the scale factor
again, so the in-game cursor was drawn hotspot * (scaleFactor - 1)
pixels up and left of the position the engine receives from mouse
events.
Restore the virtual-coordinate branch for the game cursor and pass the
dirty rects in the coordinate space they are actually in.
Changed paths:
backends/graphics/surfacesdl/surfacesdl-graphics.cpp
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index b59cc6898d8..02abddf9133 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -2521,10 +2521,19 @@ void SurfaceSdlGraphicsManager::undrawMouse() {
_mouseNextRect.x = virtualCursor.x + _gameScreenShakeXOffset;
_mouseNextRect.y = virtualCursor.y + _gameScreenShakeYOffset;
- _mouseNextRect.w = _mouseCurState.rW;
- _mouseNextRect.h = _mouseCurState.rH;
- _mouseNextRect.x -= _mouseCurState.rHotX;
- _mouseNextRect.y -= _mouseCurState.rHotY;
+ if (!_overlayInGUI) {
+ // The game cursor rect is kept in virtual coordinates: drawMouse()
+ // scales and aspect-corrects it, so subtract the virtual hotspot here
+ _mouseNextRect.w = _mouseCurState.vW;
+ _mouseNextRect.h = _mouseCurState.vH;
+ _mouseNextRect.x -= _mouseCurState.vHotX;
+ _mouseNextRect.y -= _mouseCurState.vHotY;
+ } else {
+ _mouseNextRect.w = _mouseCurState.rW;
+ _mouseNextRect.h = _mouseCurState.rH;
+ _mouseNextRect.x -= _mouseCurState.rHotX;
+ _mouseNextRect.y -= _mouseCurState.rHotY;
+ }
if (!_cursorVisible || !_mouseSurface) {
_mouseNextRect.x = _mouseNextRect.y = _mouseNextRect.w = _mouseNextRect.h = 0;
@@ -2535,14 +2544,14 @@ void SurfaceSdlGraphicsManager::undrawMouse() {
// alpha-blended cursors will happily blend into themselves if the surface
// under the cursor is not reset first
//
- // The mouse is undrawn using real coordinates, i.e. they have already
- // been scaled and aspect-ratio corrected.
+ // The mouse is undrawn using virtual coordinates, i.e. they may be
+ // scaled and aspect-ratio corrected.
if (_mouseLastRect.w != 0 && _mouseLastRect.h != 0)
- addDirtyRect(_mouseLastRect.x, _mouseLastRect.y, _mouseLastRect.w, _mouseLastRect.h, true);
+ addDirtyRect(_mouseLastRect.x, _mouseLastRect.y, _mouseLastRect.w, _mouseLastRect.h, _overlayInGUI);
if (_mouseNextRect.w != 0 && _mouseNextRect.h != 0)
- addDirtyRect(_mouseNextRect.x, _mouseNextRect.y, _mouseNextRect.w, _mouseNextRect.h, true);
+ addDirtyRect(_mouseNextRect.x, _mouseNextRect.y, _mouseNextRect.w, _mouseNextRect.h, _overlayInGUI);
}
void SurfaceSdlGraphicsManager::drawMouse() {
More information about the Scummvm-git-logs
mailing list