From 1da221279cac046e6aadf05d75fbdf21b643cfab Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 27 May 2006 12:55:28 +0000 Subject: The dirty rect produced by drawMouse() is updated without going through any scaling or aspect-ratio correction, so it has to be added using real surface coordinates. So I had to re-introduce the extra parameter to addDirtyRect(). svn-id: r22681 --- backends/sdl/graphics.cpp | 23 ++++++++++++++--------- backends/sdl/sdl-common.h | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) (limited to 'backends/sdl') diff --git a/backends/sdl/graphics.cpp b/backends/sdl/graphics.cpp index e61e673ea2..05bf1bc0e0 100644 --- a/backends/sdl/graphics.cpp +++ b/backends/sdl/graphics.cpp @@ -854,7 +854,7 @@ bool OSystem_SDL::grabRawScreen(Graphics::Surface *surf) { return true; } -void OSystem_SDL::addDirtyRect(int x, int y, int w, int h) { +void OSystem_SDL::addDirtyRect(int x, int y, int w, int h, bool realCoordinates) { if (_forceFull) return; @@ -865,7 +865,7 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h) { int height, width; - if (!_overlayVisible) { + if (!_overlayVisible && !realCoordinates) { width = _screenWidth; height = _screenHeight; } else { @@ -875,7 +875,7 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h) { // Extend the dirty region by 1 pixel for scalers // that "smear" the screen, e.g. 2xSAI - if (_modeFlags & DF_UPDATE_EXPAND_1_PIXEL) { + if ((_modeFlags & DF_UPDATE_EXPAND_1_PIXEL) && !realCoordinates) { x--; y--; w+=2; @@ -902,7 +902,7 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h) { } #ifndef DISABLE_SCALERS - if (_adjustAspectRatio && !_overlayVisible) { + if (_adjustAspectRatio && !_overlayVisible && !realCoordinates) { makeRectStretchable(x, y, w, h); } #endif @@ -1479,7 +1479,7 @@ void OSystem_SDL::drawMouse() { _mouseBackup.x = _mouseBackup.y = _mouseBackup.w = _mouseBackup.h = 0; return; } - + SDL_Rect dst; int scale; int width, height; @@ -1502,15 +1502,14 @@ void OSystem_SDL::drawMouse() { dst.h = _mouseCurState.hH; } - // Note that addDirtyRect() will perform any necessary clipping + // The mouse is undrawn using virtual coordinates, i.e. they may be + // scaled and aspect-ratio corrected. _mouseBackup.x = dst.x; _mouseBackup.y = dst.y; _mouseBackup.w = dst.w; _mouseBackup.h = dst.h; - addDirtyRect(_mouseBackup.x, _mouseBackup.y, _mouseBackup.w, _mouseBackup.h); - // We draw the pre-scaled cursor image, so now we need to adjust for // scaling, shake position and aspect ratio correction manually. @@ -1526,10 +1525,16 @@ void OSystem_SDL::drawMouse() { dst.w = _mouseCurState.hW; dst.h = _mouseCurState.hH; - // Note that SDL_BlitSurface() will perform any clipping necessary + // Note that SDL_BlitSurface() and addDirtyRect() will both perform any + // clipping necessary if (SDL_BlitSurface(_mouseSurface, NULL, _hwscreen, &dst) != 0) error("SDL_BlitSurface failed: %s", SDL_GetError()); + + // The screen will be updated using real surface coordinates, i.e. + // they will not be scaled or aspect-ratio corrected. + + addDirtyRect(dst.x, dst.y, dst.w, dst.h, true); } #pragma mark - diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h index 91d1169169..12a93faa1c 100644 --- a/backends/sdl/sdl-common.h +++ b/backends/sdl/sdl-common.h @@ -339,7 +339,7 @@ protected: void addDirtyRgnAuto(const byte *buf); void makeChecksums(const byte *buf); - virtual void addDirtyRect(int x, int y, int w, int h); // overloaded by CE backend + virtual void addDirtyRect(int x, int y, int w, int h, bool realCoordinates = false); // overloaded by CE backend virtual void drawMouse(); // overloaded by CE backend virtual void undrawMouse(); // overloaded by CE backend (FIXME) -- cgit v1.2.3