Renamed aspectRatio to aspectRatioCorrection in the SDL backend to match the accessor functions

(don't worry, o reader, for this is the only modification going to the SVN :) )

svn-id: r40226
This commit is contained in:
Bertrand Augereau 2009-05-01 09:09:07 +00:00
parent 912b3f64bb
commit bb2540a4d1
4 changed files with 26 additions and 26 deletions

View file

@ -80,7 +80,7 @@ void OSystem_SDL::fillMouseEvent(Common::Event &event, int x, int y) {
if (!_overlayVisible) { if (!_overlayVisible) {
event.mouse.x /= _videoMode.scaleFactor; event.mouse.x /= _videoMode.scaleFactor;
event.mouse.y /= _videoMode.scaleFactor; event.mouse.y /= _videoMode.scaleFactor;
if (_videoMode.aspectRatio) if (_videoMode.aspectRatioCorrection)
event.mouse.y = aspect2Real(event.mouse.y); event.mouse.y = aspect2Real(event.mouse.y);
} }
} }

View file

@ -111,10 +111,10 @@ OSystem::TransactionError OSystem_SDL::endGFXTransaction(void) {
errors |= kTransactionFullscreenFailed; errors |= kTransactionFullscreenFailed;
_videoMode.fullscreen = _oldVideoMode.fullscreen; _videoMode.fullscreen = _oldVideoMode.fullscreen;
} else if (_videoMode.aspectRatio != _oldVideoMode.aspectRatio) { } else if (_videoMode.aspectRatioCorrection != _oldVideoMode.aspectRatioCorrection) {
errors |= kTransactionAspectRatioFailed; errors |= kTransactionAspectRatioFailed;
_videoMode.aspectRatio = _oldVideoMode.aspectRatio; _videoMode.aspectRatioCorrection = _oldVideoMode.aspectRatioCorrection;
} else if (_videoMode.mode != _oldVideoMode.mode) { } else if (_videoMode.mode != _oldVideoMode.mode) {
errors |= kTransactionModeSwitchFailed; errors |= kTransactionModeSwitchFailed;
@ -130,7 +130,7 @@ OSystem::TransactionError OSystem_SDL::endGFXTransaction(void) {
} }
if (_videoMode.fullscreen == _oldVideoMode.fullscreen && if (_videoMode.fullscreen == _oldVideoMode.fullscreen &&
_videoMode.aspectRatio == _oldVideoMode.aspectRatio && _videoMode.aspectRatioCorrection == _oldVideoMode.aspectRatioCorrection &&
_videoMode.mode == _oldVideoMode.mode && _videoMode.mode == _oldVideoMode.mode &&
_videoMode.screenWidth == _oldVideoMode.screenWidth && _videoMode.screenWidth == _oldVideoMode.screenWidth &&
_videoMode.screenHeight == _oldVideoMode.screenHeight) { _videoMode.screenHeight == _oldVideoMode.screenHeight) {
@ -369,9 +369,9 @@ bool OSystem_SDL::loadGFXMode() {
_videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor;
if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400) if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400)
_videoMode.aspectRatio = false; _videoMode.aspectRatioCorrection = false;
if (_videoMode.aspectRatio) if (_videoMode.aspectRatioCorrection)
_videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight); _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight);
hwW = _videoMode.screenWidth * _videoMode.scaleFactor; hwW = _videoMode.screenWidth * _videoMode.scaleFactor;
@ -593,7 +593,7 @@ void OSystem_SDL::internUpdateScreen() {
if (_currentShakePos != _newShakePos) { if (_currentShakePos != _newShakePos) {
SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor}; SDL_Rect blackrect = {0, 0, _videoMode.screenWidth * _videoMode.scaleFactor, _newShakePos * _videoMode.scaleFactor};
if (_videoMode.aspectRatio && !_overlayVisible) if (_videoMode.aspectRatioCorrection && !_overlayVisible)
blackrect.h = real2Aspect(blackrect.h - 1) + 1; blackrect.h = real2Aspect(blackrect.h - 1) + 1;
SDL_FillRect(_hwscreen, &blackrect, 0); SDL_FillRect(_hwscreen, &blackrect, 0);
@ -702,7 +702,7 @@ void OSystem_SDL::internUpdateScreen() {
orig_dst_y = dst_y; orig_dst_y = dst_y;
dst_y = dst_y * scale1; dst_y = dst_y * scale1;
if (_videoMode.aspectRatio && !_overlayVisible) if (_videoMode.aspectRatioCorrection && !_overlayVisible)
dst_y = real2Aspect(dst_y); dst_y = real2Aspect(dst_y);
assert(scalerProc != NULL); assert(scalerProc != NULL);
@ -716,7 +716,7 @@ void OSystem_SDL::internUpdateScreen() {
r->h = dst_h * scale1; r->h = dst_h * scale1;
#ifndef DISABLE_SCALERS #ifndef DISABLE_SCALERS
if (_videoMode.aspectRatio && orig_dst_y < height && !_overlayVisible) if (_videoMode.aspectRatioCorrection && orig_dst_y < height && !_overlayVisible)
r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1); r->h = stretch200To240((uint8 *) _hwscreen->pixels, dstPitch, r->w, r->h, r->x, r->y, orig_dst_y * scale1);
#endif #endif
} }
@ -768,11 +768,11 @@ void OSystem_SDL::setFullscreenMode(bool enable) {
void OSystem_SDL::setAspectRatioCorrection(bool enable) { void OSystem_SDL::setAspectRatioCorrection(bool enable) {
Common::StackLock lock(_graphicsMutex); Common::StackLock lock(_graphicsMutex);
if (_oldVideoMode.setup && _oldVideoMode.aspectRatio == enable) if (_oldVideoMode.setup && _oldVideoMode.aspectRatioCorrection == enable)
return; return;
if (_transactionMode == kTransactionActive) { if (_transactionMode == kTransactionActive) {
_videoMode.aspectRatio = enable; _videoMode.aspectRatioCorrection = enable;
_transactionDetails.needHotswap = true; _transactionDetails.needHotswap = true;
} }
} }
@ -936,7 +936,7 @@ void OSystem_SDL::addDirtyRect(int x, int y, int w, int h, bool realCoordinates)
} }
#ifndef DISABLE_SCALERS #ifndef DISABLE_SCALERS
if (_videoMode.aspectRatio && !_overlayVisible && !realCoordinates) { if (_videoMode.aspectRatioCorrection && !_overlayVisible && !realCoordinates) {
makeRectStretchable(x, y, w, h); makeRectStretchable(x, y, w, h);
} }
#endif #endif
@ -1131,7 +1131,7 @@ void OSystem_SDL::showOverlay() {
// Since resolution could change, put mouse to adjusted position // Since resolution could change, put mouse to adjusted position
// Fixes bug #1349059 // Fixes bug #1349059
x = _mouseCurState.x * _videoMode.scaleFactor; x = _mouseCurState.x * _videoMode.scaleFactor;
if (_videoMode.aspectRatio) if (_videoMode.aspectRatioCorrection)
y = real2Aspect(_mouseCurState.y) * _videoMode.scaleFactor; y = real2Aspect(_mouseCurState.y) * _videoMode.scaleFactor;
else else
y = _mouseCurState.y * _videoMode.scaleFactor; y = _mouseCurState.y * _videoMode.scaleFactor;
@ -1155,7 +1155,7 @@ void OSystem_SDL::hideOverlay() {
// Fixes bug #1349059 // Fixes bug #1349059
x = _mouseCurState.x / _videoMode.scaleFactor; x = _mouseCurState.x / _videoMode.scaleFactor;
y = _mouseCurState.y / _videoMode.scaleFactor; y = _mouseCurState.y / _videoMode.scaleFactor;
if (_videoMode.aspectRatio) if (_videoMode.aspectRatioCorrection)
y = aspect2Real(y); y = aspect2Real(y);
warpMouse(x, y); warpMouse(x, y);
@ -1188,7 +1188,7 @@ void OSystem_SDL::clearOverlay() {
(byte *)_overlayscreen->pixels, _overlayscreen->pitch, _videoMode.screenWidth, _videoMode.screenHeight); (byte *)_overlayscreen->pixels, _overlayscreen->pitch, _videoMode.screenWidth, _videoMode.screenHeight);
#ifndef DISABLE_SCALERS #ifndef DISABLE_SCALERS
if (_videoMode.aspectRatio) if (_videoMode.aspectRatioCorrection)
stretch200To240((uint8 *)_overlayscreen->pixels, _overlayscreen->pitch, stretch200To240((uint8 *)_overlayscreen->pixels, _overlayscreen->pitch,
_videoMode.overlayWidth, _videoMode.screenHeight * _videoMode.scaleFactor, 0, 0, 0); _videoMode.overlayWidth, _videoMode.screenHeight * _videoMode.scaleFactor, 0, 0, 0);
#endif #endif
@ -1291,7 +1291,7 @@ void OSystem_SDL::setMousePos(int x, int y) {
void OSystem_SDL::warpMouse(int x, int y) { void OSystem_SDL::warpMouse(int x, int y) {
int y1 = y; int y1 = y;
if (_videoMode.aspectRatio && !_overlayVisible) if (_videoMode.aspectRatioCorrection && !_overlayVisible)
y1 = real2Aspect(y); y1 = real2Aspect(y);
if (_mouseCurState.x != x || _mouseCurState.y != y) { if (_mouseCurState.x != x || _mouseCurState.y != y) {
@ -1444,7 +1444,7 @@ void OSystem_SDL::blitCursor() {
int rH1 = rH; // store original to pass to aspect-correction function later int rH1 = rH; // store original to pass to aspect-correction function later
#endif #endif
if (_videoMode.aspectRatio && _cursorTargetScale == 1) { if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1) {
rH = real2Aspect(rH - 1) + 1; rH = real2Aspect(rH - 1) + 1;
_mouseCurState.rHotY = real2Aspect(_mouseCurState.rHotY); _mouseCurState.rHotY = real2Aspect(_mouseCurState.rHotY);
} }
@ -1489,7 +1489,7 @@ void OSystem_SDL::blitCursor() {
_mouseCurState.w, _mouseCurState.h); _mouseCurState.w, _mouseCurState.h);
#ifndef DISABLE_SCALERS #ifndef DISABLE_SCALERS
if (_videoMode.aspectRatio && _cursorTargetScale == 1) if (_videoMode.aspectRatioCorrection && _cursorTargetScale == 1)
cursorStretch200To240((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, rW, rH1, 0, 0, 0); cursorStretch200To240((uint8 *)_mouseSurface->pixels, _mouseSurface->pitch, rW, rH1, 0, 0, 0);
#endif #endif
@ -1586,7 +1586,7 @@ void OSystem_SDL::drawMouse() {
dst.y += _currentShakePos; dst.y += _currentShakePos;
} }
if (_videoMode.aspectRatio && !_overlayVisible) if (_videoMode.aspectRatioCorrection && !_overlayVisible)
dst.y = real2Aspect(dst.y); dst.y = real2Aspect(dst.y);
dst.x = scale * dst.x - _mouseCurState.rHotX; dst.x = scale * dst.x - _mouseCurState.rHotX;
@ -1703,11 +1703,11 @@ void OSystem_SDL::handleScalerHotkeys(const SDL_KeyboardEvent &key) {
// Ctrl-Alt-a toggles aspect ratio correction // Ctrl-Alt-a toggles aspect ratio correction
if (key.keysym.sym == 'a') { if (key.keysym.sym == 'a') {
beginGFXTransaction(); beginGFXTransaction();
setFeatureState(kFeatureAspectRatioCorrection, !_videoMode.aspectRatio); setFeatureState(kFeatureAspectRatioCorrection, !_videoMode.aspectRatioCorrection);
endGFXTransaction(); endGFXTransaction();
#ifdef USE_OSD #ifdef USE_OSD
char buffer[128]; char buffer[128];
if (_videoMode.aspectRatio) if (_videoMode.aspectRatioCorrection)
sprintf(buffer, "Enabled aspect ratio correction\n%d x %d -> %d x %d", sprintf(buffer, "Enabled aspect ratio correction\n%d x %d -> %d x %d",
_videoMode.screenWidth, _videoMode.screenHeight, _videoMode.screenWidth, _videoMode.screenHeight,
_hwscreen->w, _hwscreen->h _hwscreen->w, _hwscreen->h

View file

@ -123,12 +123,12 @@ void OSystem_SDL::initBackend() {
#if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && !defined(DISABLE_SCALERS) #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) && !defined(DISABLE_SCALERS)
_videoMode.mode = GFX_DOUBLESIZE; _videoMode.mode = GFX_DOUBLESIZE;
_videoMode.scaleFactor = 2; _videoMode.scaleFactor = 2;
_videoMode.aspectRatio = ConfMan.getBool("aspect_ratio"); _videoMode.aspectRatioCorrection = ConfMan.getBool("aspect_ratio");
_scalerProc = Normal2x; _scalerProc = Normal2x;
#else // for small screen platforms #else // for small screen platforms
_videoMode.mode = GFX_NORMAL; _videoMode.mode = GFX_NORMAL;
_videoMode.scaleFactor = 1; _videoMode.scaleFactor = 1;
_videoMode.aspectRatio = false; _videoMode.aspectRatioCorrection = false;
_scalerProc = Normal1x; _scalerProc = Normal1x;
#endif #endif
_scalerType = 0; _scalerType = 0;
@ -438,7 +438,7 @@ bool OSystem_SDL::getFeatureState(Feature f) {
case kFeatureFullscreenMode: case kFeatureFullscreenMode:
return _videoMode.fullscreen; return _videoMode.fullscreen;
case kFeatureAspectRatioCorrection: case kFeatureAspectRatioCorrection:
return _videoMode.aspectRatio; return _videoMode.aspectRatioCorrection;
case kFeatureAutoComputeDirtyRects: case kFeatureAutoComputeDirtyRects:
return _modeFlags & DF_WANT_RECT_OPTIM; return _modeFlags & DF_WANT_RECT_OPTIM;
default: default:

View file

@ -267,7 +267,7 @@ protected:
bool setup; bool setup;
bool fullscreen; bool fullscreen;
bool aspectRatio; bool aspectRatioCorrection;
int mode; int mode;
int scaleFactor; int scaleFactor;
@ -425,7 +425,7 @@ protected:
virtual bool saveScreenshot(const char *filename); // overloaded by CE backend virtual bool saveScreenshot(const char *filename); // overloaded by CE backend
int effectiveScreenHeight() const { int effectiveScreenHeight() const {
return (_videoMode.aspectRatio ? real2Aspect(_videoMode.screenHeight) : _videoMode.screenHeight) return (_videoMode.aspectRatioCorrection ? real2Aspect(_videoMode.screenHeight) : _videoMode.screenHeight)
* _videoMode.scaleFactor; * _videoMode.scaleFactor;
} }