diff options
author | Thierry Crozat | 2018-10-21 18:35:40 +0100 |
---|---|---|
committer | Thierry Crozat | 2018-10-24 23:34:41 +0200 |
commit | 3b542cea53b94bc10592a618f60c4f813e518b60 (patch) | |
tree | 1a425d7228c2140611b720e89ff7ba26c6fbbbed /backends/graphics | |
parent | 2aa7f71fc0be2d1776213fda79ea850c6547bbe5 (diff) | |
download | scummvm-rg350-3b542cea53b94bc10592a618f60c4f813e518b60.tar.gz scummvm-rg350-3b542cea53b94bc10592a618f60c4f813e518b60.tar.bz2 scummvm-rg350-3b542cea53b94bc10592a618f60c4f813e518b60.zip |
SURFACESDL: Respect filtering setting when performing aspect ratio correction
Diffstat (limited to 'backends/graphics')
5 files changed, 17 insertions, 28 deletions
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp index fa2217dfd8..6a935ea75b 100644 --- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp +++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp @@ -372,7 +372,7 @@ void DINGUXSdlGraphicsManager::internUpdateScreen() { #ifdef USE_SCALERS 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, _videoMode.filtering); #endif } SDL_UnlockSurface(srcSurf); diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp index 910dab9140..5ec36c25c6 100644 --- a/backends/graphics/gph/gph-graphics.cpp +++ b/backends/graphics/gph/gph-graphics.cpp @@ -395,7 +395,7 @@ void GPHGraphicsManager::internUpdateScreen() { #ifdef USE_SCALERS 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, _videoMode.filtering); #endif } SDL_UnlockSurface(srcSurf); diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp index 57b7f8136b..bb78435797 100644 --- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp +++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp @@ -406,7 +406,7 @@ void LinuxmotoSdlGraphicsManager::internUpdateScreen() { #ifdef USE_SCALERS 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, _videoMode.filtering); #endif } SDL_UnlockSurface(srcSurf); diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index ac758e4424..3e9aa9faab 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -204,8 +204,8 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou _videoMode.fullscreen = true; #endif -#if SDL_VERSION_ATLEAST(2, 0, 0) _videoMode.filtering = ConfMan.getBool("filtering"); +#if SDL_VERSION_ATLEAST(2, 0, 0) _videoMode.stretchMode = STRETCH_FIT; #endif @@ -254,8 +254,8 @@ bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) const { return (f == OSystem::kFeatureFullscreenMode) || (f == OSystem::kFeatureAspectRatioCorrection) || -#if SDL_VERSION_ATLEAST(2, 0, 0) (f == OSystem::kFeatureFilteringMode) || +#if SDL_VERSION_ATLEAST(2, 0, 0) (f == OSystem::kFeatureStretchMode) || #endif (f == OSystem::kFeatureCursorPalette) || @@ -270,11 +270,9 @@ void SurfaceSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) case OSystem::kFeatureAspectRatioCorrection: setAspectRatioCorrection(enable); break; -#if SDL_VERSION_ATLEAST(2, 0, 0) case OSystem::kFeatureFilteringMode: setFilteringMode(enable); break; -#endif case OSystem::kFeatureCursorPalette: _cursorPaletteDisabled = !enable; blitCursor(); @@ -299,10 +297,8 @@ bool SurfaceSdlGraphicsManager::getFeatureState(OSystem::Feature f) const { return _videoMode.fullscreen; case OSystem::kFeatureAspectRatioCorrection: return _videoMode.aspectRatioCorrection; -#if SDL_VERSION_ATLEAST(2, 0, 0) case OSystem::kFeatureFilteringMode: return _videoMode.filtering; -#endif case OSystem::kFeatureCursorPalette: return !_cursorPaletteDisabled; default: @@ -371,11 +367,11 @@ OSystem::TransactionError SurfaceSdlGraphicsManager::endGFXTransaction() { errors |= OSystem::kTransactionStretchModeSwitchFailed; _videoMode.stretchMode = _oldVideoMode.stretchMode; +#endif } else if (_videoMode.filtering != _oldVideoMode.filtering) { errors |= OSystem::kTransactionFilteringFailed; _videoMode.filtering = _oldVideoMode.filtering; -#endif #ifdef USE_RGB_COLOR } else if (_videoMode.format != _oldVideoMode.format) { errors |= OSystem::kTransactionFormatNotSupported; @@ -395,9 +391,7 @@ OSystem::TransactionError SurfaceSdlGraphicsManager::endGFXTransaction() { if (_videoMode.fullscreen == _oldVideoMode.fullscreen && _videoMode.aspectRatioCorrection == _oldVideoMode.aspectRatioCorrection && _videoMode.mode == _oldVideoMode.mode && -#if SDL_VERSION_ATLEAST(2, 0, 0) _videoMode.filtering == _oldVideoMode.filtering && -#endif _videoMode.screenWidth == _oldVideoMode.screenWidth && _videoMode.screenHeight == _oldVideoMode.screenHeight) { @@ -1329,7 +1323,7 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() { #ifdef USE_SCALERS 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, _videoMode.filtering); #endif } SDL_UnlockSurface(srcSurf); @@ -1520,7 +1514,6 @@ void SurfaceSdlGraphicsManager::setAspectRatioCorrection(bool enable) { } } -#if SDL_VERSION_ATLEAST(2, 0, 0) void SurfaceSdlGraphicsManager::setFilteringMode(bool enable) { Common::StackLock lock(_graphicsMutex); @@ -1529,10 +1522,11 @@ void SurfaceSdlGraphicsManager::setFilteringMode(bool enable) { if (_transactionMode == kTransactionActive) { _videoMode.filtering = enable; +#if SDL_VERSION_ATLEAST(2, 0, 0) _transactionDetails.needTextureUpdate = true; +#endif } } -#endif void SurfaceSdlGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { assert(_transactionMode == kTransactionNone); @@ -1663,9 +1657,8 @@ void SurfaceSdlGraphicsManager::addDirtyRect(int x, int y, int w, int h, bool re } #ifdef USE_SCALERS - if (_videoMode.aspectRatioCorrection && !_overlayVisible && !realCoordinates) { - makeRectStretchable(x, y, w, h); - } + if (_videoMode.aspectRatioCorrection && !_overlayVisible && !realCoordinates) + makeRectStretchable(x, y, w, h, _videoMode.filtering); #endif if (w == width && h == height) { @@ -1825,7 +1818,8 @@ void SurfaceSdlGraphicsManager::clearOverlay() { #ifdef USE_SCALERS if (_videoMode.aspectRatioCorrection) stretch200To240((uint8 *)_overlayscreen->pixels, _overlayscreen->pitch, - _videoMode.overlayWidth, _videoMode.screenHeight * _videoMode.scaleFactor, 0, 0, 0); + _videoMode.overlayWidth, _videoMode.screenHeight * _videoMode.scaleFactor, 0, 0, 0, + _videoMode.filtering); #endif SDL_UnlockSurface(_tmpscreen); SDL_UnlockSurface(_overlayscreen); @@ -2209,8 +2203,7 @@ void SurfaceSdlGraphicsManager::blitCursor() { } #ifdef USE_SCALERS -// Basically it is kVeryFastAndUglyAspectMode of stretch200To240 from -// common/scale/aspect.cpp +// Basically it is stretch200To240Nearest from common/scale/aspect.cpp static int cursorStretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, int srcY, int origSrcY) { int maxDstY = real2Aspect(origSrcY + height - 1); int y; @@ -2538,7 +2531,6 @@ bool SurfaceSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) { return true; } -#if SDL_VERSION_ATLEAST(2, 0, 0) // Ctrl-Alt-f toggles filtering if (key == 'f') { beginGFXTransaction(); @@ -2555,7 +2547,6 @@ bool SurfaceSdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) { internUpdateScreen(); return true; } -#endif #if SDL_VERSION_ATLEAST(2, 0, 0) // Ctrl+Alt+s cycles through scaling mode (0 to 3) @@ -2676,9 +2667,9 @@ bool SurfaceSdlGraphicsManager::isScalerHotkey(const Common::Event &event) { if (keyValue >= ARRAYSIZE(s_gfxModeSwitchTable)) return false; } -#if SDL_VERSION_ATLEAST(2, 0, 0) if (event.kbd.keycode == 'f') return true; +#if SDL_VERSION_ATLEAST(2, 0, 0) if (event.kbd.keycode == 's') return true; #endif diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h index 6e7fec4823..3866bc3810 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.h +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h @@ -248,9 +248,9 @@ protected: bool fullscreen; bool aspectRatioCorrection; AspectRatio desiredAspectRatio; - -#if SDL_VERSION_ATLEAST(2, 0, 0) bool filtering; + +#if SDL_VERSION_ATLEAST(2, 0, 0) int stretchMode; #endif @@ -381,9 +381,7 @@ protected: virtual bool hotswapGFXMode(); virtual void setAspectRatioCorrection(bool enable); -#if SDL_VERSION_ATLEAST(2, 0, 0) void setFilteringMode(bool enable); -#endif virtual bool saveScreenshot(const char *filename); virtual void setGraphicsModeIntern(); |