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
This commit is contained in:
Torbjörn Andersson 2006-05-27 12:55:28 +00:00
parent 1b2485f4af
commit 1da221279c
2 changed files with 15 additions and 10 deletions

View file

@ -854,7 +854,7 @@ bool OSystem_SDL::grabRawScreen(Graphics::Surface *surf) {
return true; 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) if (_forceFull)
return; return;
@ -865,7 +865,7 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h) {
int height, width; int height, width;
if (!_overlayVisible) { if (!_overlayVisible && !realCoordinates) {
width = _screenWidth; width = _screenWidth;
height = _screenHeight; height = _screenHeight;
} else { } 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 // Extend the dirty region by 1 pixel for scalers
// that "smear" the screen, e.g. 2xSAI // that "smear" the screen, e.g. 2xSAI
if (_modeFlags & DF_UPDATE_EXPAND_1_PIXEL) { if ((_modeFlags & DF_UPDATE_EXPAND_1_PIXEL) && !realCoordinates) {
x--; x--;
y--; y--;
w+=2; w+=2;
@ -902,7 +902,7 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h) {
} }
#ifndef DISABLE_SCALERS #ifndef DISABLE_SCALERS
if (_adjustAspectRatio && !_overlayVisible) { if (_adjustAspectRatio && !_overlayVisible && !realCoordinates) {
makeRectStretchable(x, y, w, h); makeRectStretchable(x, y, w, h);
} }
#endif #endif
@ -1502,15 +1502,14 @@ void OSystem_SDL::drawMouse() {
dst.h = _mouseCurState.hH; 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.x = dst.x;
_mouseBackup.y = dst.y; _mouseBackup.y = dst.y;
_mouseBackup.w = dst.w; _mouseBackup.w = dst.w;
_mouseBackup.h = dst.h; _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 // We draw the pre-scaled cursor image, so now we need to adjust for
// scaling, shake position and aspect ratio correction manually. // scaling, shake position and aspect ratio correction manually.
@ -1526,10 +1525,16 @@ void OSystem_SDL::drawMouse() {
dst.w = _mouseCurState.hW; dst.w = _mouseCurState.hW;
dst.h = _mouseCurState.hH; 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) if (SDL_BlitSurface(_mouseSurface, NULL, _hwscreen, &dst) != 0)
error("SDL_BlitSurface failed: %s", SDL_GetError()); 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 - #pragma mark -

View file

@ -339,7 +339,7 @@ protected:
void addDirtyRgnAuto(const byte *buf); void addDirtyRgnAuto(const byte *buf);
void makeChecksums(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 drawMouse(); // overloaded by CE backend
virtual void undrawMouse(); // overloaded by CE backend (FIXME) virtual void undrawMouse(); // overloaded by CE backend (FIXME)