diff options
| author | Cameron Cawley | 2019-06-22 13:17:19 +0100 |
|---|---|---|
| committer | Filippos Karapetis | 2019-06-24 02:19:28 +0300 |
| commit | 16f8c024d1dfba31e9f764818936384a429ac663 (patch) | |
| tree | 5472dbec1944674de6fe9a5d4f6ee03dc0267e72 /backends/graphics/openglsdl | |
| parent | c57b2cc14888367ac09f67982e6571ba71202e2c (diff) | |
| download | scummvm-rg350-16f8c024d1dfba31e9f764818936384a429ac663.tar.gz scummvm-rg350-16f8c024d1dfba31e9f764818936384a429ac663.tar.bz2 scummvm-rg350-16f8c024d1dfba31e9f764818936384a429ac663.zip | |
OPENGLSDL: Move stretch mode handling into OpenGLGraphicsManager
Diffstat (limited to 'backends/graphics/openglsdl')
| -rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 62 | ||||
| -rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.h | 6 |
2 files changed, 7 insertions, 61 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index f76a100521..2d2a1bac7b 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -39,7 +39,7 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt #else _lastVideoModeLoad(0), #endif - _graphicsScale(2), _stretchMode(STRETCH_FIT), _ignoreLoadVideoMode(false), _gotResize(false), _wantsFullScreen(false), _ignoreResizeEvents(0), + _graphicsScale(2), _ignoreLoadVideoMode(false), _gotResize(false), _wantsFullScreen(false), _ignoreResizeEvents(0), _desiredFullscreenWidth(0), _desiredFullscreenHeight(0) { // Setup OpenGL attributes for SDL SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); @@ -218,7 +218,6 @@ void OpenGLSdlGraphicsManager::deactivateManager() { bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) const { switch (f) { case OSystem::kFeatureFullscreenMode: - case OSystem::kFeatureStretchMode: case OSystem::kFeatureIconifyWindow: return true; @@ -267,54 +266,6 @@ bool OpenGLSdlGraphicsManager::getFeatureState(OSystem::Feature f) const { } } -namespace { -const OSystem::GraphicsMode sdlGlStretchModes[] = { - {"center", _s("Center"), STRETCH_CENTER}, - {"pixel-perfect", _s("Pixel-perfect scaling"), STRETCH_INTEGRAL}, - {"fit", _s("Fit to window"), STRETCH_FIT}, - {"stretch", _s("Stretch to window"), STRETCH_STRETCH}, - {nullptr, nullptr, 0} -}; - -} // End of anonymous namespace - -const OSystem::GraphicsMode *OpenGLSdlGraphicsManager::getSupportedStretchModes() const { - return sdlGlStretchModes; -} - -int OpenGLSdlGraphicsManager::getDefaultStretchMode() const { - return STRETCH_FIT; -} - -bool OpenGLSdlGraphicsManager::setStretchMode(int mode) { - assert(getTransactionMode() != kTransactionNone); - - if (mode == _stretchMode) - return true; - - // Check this is a valid mode - const OSystem::GraphicsMode *sm = sdlGlStretchModes; - bool found = false; - while (sm->name) { - if (sm->id == mode) { - found = true; - break; - } - sm++; - } - if (!found) { - warning("unknown stretch mode %d", mode); - return false; - } - - _stretchMode = mode; - return true; -} - -int OpenGLSdlGraphicsManager::getStretchMode() const { - return _stretchMode; -} - void OpenGLSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) { // HACK: This is stupid but the SurfaceSDL backend defaults to 2x. This // assures that the launcher (which requests 320x200) has a reasonable @@ -705,24 +656,25 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { // Ctrl+Alt+s cycles through stretch mode int index = 0; - const OSystem::GraphicsMode *sm = sdlGlStretchModes; + const OSystem::GraphicsMode *stretchModes = getSupportedStretchModes(); + const OSystem::GraphicsMode *sm = stretchModes; while (sm->name) { - if (sm->id == _stretchMode) + if (sm->id == getStretchMode()) break; sm++; index++; } index++; - if (!sdlGlStretchModes[index].name) + if (!stretchModes[index].name) index = 0; beginGFXTransaction(); - setStretchMode(sdlGlStretchModes[index].id); + setStretchMode(stretchModes[index].id); endGFXTransaction(); #ifdef USE_OSD Common::String message = Common::String::format("%s: %s", _("Stretch mode"), - _(sdlGlStretchModes[index].description) + _(stretchModes[index].description) ); displayMessageOnOSD(message.c_str()); #endif diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h index ff2277669e..2729a529fd 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/openglsdl/openglsdl-graphics.h @@ -43,11 +43,6 @@ public: virtual void setFeatureState(OSystem::Feature f, bool enable) override; virtual bool getFeatureState(OSystem::Feature f) const override; - virtual const OSystem::GraphicsMode *getSupportedStretchModes() const override; - virtual int getDefaultStretchMode() const override; - virtual bool setStretchMode(int mode) override; - virtual int getStretchMode() const override; - virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format) override; virtual void updateScreen() override; @@ -84,7 +79,6 @@ private: uint _lastRequestedWidth; uint _lastRequestedHeight; uint _graphicsScale; - int _stretchMode; bool _ignoreLoadVideoMode; bool _gotResize; |
