aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2006-05-25 19:43:33 +0000
committerWillem Jan Palenstijn2006-05-25 19:43:33 +0000
commit14774d17604be444471dbb1a92e1ee3b7340f858 (patch)
tree121b170326fd60ad000d96b5a59b68d8ef4982e4 /backends
parent0e6831fa325ccb17952ad4cb853e477f184f6b45 (diff)
downloadscummvm-rg350-14774d17604be444471dbb1a92e1ee3b7340f858.tar.gz
scummvm-rg350-14774d17604be444471dbb1a92e1ee3b7340f858.tar.bz2
scummvm-rg350-14774d17604be444471dbb1a92e1ee3b7340f858.zip
fix hotspot handling when overlay visible
svn-id: r22631
Diffstat (limited to 'backends')
-rw-r--r--backends/sdl/graphics.cpp32
-rw-r--r--backends/sdl/sdl-common.h8
-rw-r--r--backends/sdl/sdl.cpp3
3 files changed, 22 insertions, 21 deletions
diff --git a/backends/sdl/graphics.cpp b/backends/sdl/graphics.cpp
index 8baeb94ab8..dd6f4b1d6f 100644
--- a/backends/sdl/graphics.cpp
+++ b/backends/sdl/graphics.cpp
@@ -1271,8 +1271,8 @@ void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x,
if (w == 0 || h == 0)
return;
- _mouseHotspotX = hotspot_x;
- _mouseHotspotY = hotspot_y;
+ _mouseCurState.hotX = hotspot_x;
+ _mouseCurState.hotY = hotspot_y;
_mouseKeyColor = keycolor;
@@ -1353,18 +1353,26 @@ void OSystem_SDL::blitCursor() {
dstPtr += _mouseOrigSurface->pitch - w * 2;
}
- int hW, hH, hH1;
+ int hW, hH;
if (_cursorTargetScale >= _scaleFactor) {
hW = w;
- hH = hH1 = h;
+ hH = h;
+ _mouseCurState.hHotX = _mouseCurState.hotX;
+ _mouseCurState.hHotY = _mouseCurState.hotY;
} else {
hW = w * _scaleFactor / _cursorTargetScale;
- hH = hH1 = h * _scaleFactor / _cursorTargetScale;
+ hH = h * _scaleFactor / _cursorTargetScale;
+ _mouseCurState.hHotX = _mouseCurState.hotX * _scaleFactor /
+ _cursorTargetScale;
+ _mouseCurState.hHotY = _mouseCurState.hotY * _scaleFactor /
+ _cursorTargetScale;
}
+ int hH1 = hH; // store original to pass to aspect-correction function later
if (_adjustAspectRatio && _cursorTargetScale == 1) {
hH = real2Aspect(hH - 1) + 1;
+ _mouseCurState.hHotY = real2Aspect(_mouseCurState.hHotY);
}
if (_mouseCurState.hW != hW || _mouseCurState.hH != hH) {
@@ -1473,20 +1481,14 @@ void OSystem_SDL::drawMouse() {
scale = _scaleFactor;
width = _screenWidth;
height = _screenHeight;
+ dst.x = _mouseCurState.x - _mouseCurState.hotX;
+ dst.y = _mouseCurState.y - _mouseCurState.hotY;
} else {
scale = 1;
width = _overlayWidth;
height = _overlayHeight;
- }
-
- useCursorScaling = (scale >= _cursorTargetScale);
-
- if (useCursorScaling) {
- dst.x = _mouseCurState.x - _mouseHotspotX / _cursorTargetScale;
- dst.y = _mouseCurState.y - _mouseHotspotY / _cursorTargetScale;
- } else {
- dst.x = _mouseCurState.x - _mouseHotspotX;
- dst.y = _mouseCurState.y - _mouseHotspotY;
+ dst.x = _mouseCurState.x - _mouseCurState.hHotX;
+ dst.y = _mouseCurState.y - _mouseCurState.hHotY;
}
if (_overlayVisible) {
diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h
index b0d82e7e70..91d1169169 100644
--- a/backends/sdl/sdl-common.h
+++ b/backends/sdl/sdl-common.h
@@ -293,8 +293,10 @@ protected:
};
struct MousePos {
- int16 x, y, w, h, hW, hH;
- MousePos() : x(0), y(0), w(0), h(0), hW(0), hH(0) {}
+ int16 x, y, w, h, hotX, hotY, hW, hH, hHotX, hHotY;
+ MousePos() : x(0), y(0), w(0), h(0), hotX(0), hotY(0),
+ hW(0), hH(0), hHotX(0), hHotY(0)
+ { }
};
// mouse
@@ -304,8 +306,6 @@ protected:
byte *_mouseData;
SDL_Rect _mouseBackup;
MousePos _mouseCurState;
- int16 _mouseHotspotX;
- int16 _mouseHotspotY;
byte _mouseKeyColor;
int _cursorTargetScale;
bool _cursorPaletteDisabled;
diff --git a/backends/sdl/sdl.cpp b/backends/sdl/sdl.cpp
index 3209a6dc3d..274ebec193 100644
--- a/backends/sdl/sdl.cpp
+++ b/backends/sdl/sdl.cpp
@@ -180,8 +180,7 @@ OSystem_SDL::OSystem_SDL()
_samplesPerSec(0),
_cdrom(0), _scalerProc(0), _modeChanged(false), _dirtyChecksums(0),
_mouseVisible(false), _mouseDrawn(false), _mouseData(0), _mouseSurface(0),
- _mouseOrigSurface(0), _mouseHotspotX(0), _mouseHotspotY(0), _cursorTargetScale(1),
- _cursorPaletteDisabled(true),
+ _mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true),
_joystick(0),
_currentShakePos(0), _newShakePos(0),
_paletteDirtyStart(0), _paletteDirtyEnd(0),