diff options
author | Johannes Schickel | 2011-03-17 20:29:48 +0100 |
---|---|---|
committer | Johannes Schickel | 2011-03-17 21:20:20 +0100 |
commit | f490e6f361e55c2347b51611eb8f03a721630421 (patch) | |
tree | def150751a0f19ee74e3e92ac686257a655cc6ae /backends/graphics | |
parent | 83b199e9212092bcc737e36eb3f0cff0666ddeac (diff) | |
download | scummvm-rg350-f490e6f361e55c2347b51611eb8f03a721630421.tar.gz scummvm-rg350-f490e6f361e55c2347b51611eb8f03a721630421.tar.bz2 scummvm-rg350-f490e6f361e55c2347b51611eb8f03a721630421.zip |
OPENGLSDL: More refactoring to avoid direct access of OpenGlGraphicsManager's members.
Diffstat (limited to 'backends/graphics')
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.h | 5 | ||||
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 18 |
2 files changed, 16 insertions, 7 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index c8b64fab89..8432d8346c 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -181,6 +181,11 @@ protected: void setFullscreenMode(bool enable); /** + * Query the fullscreen state. + */ + inline bool getFullscreenMode() const { return _videoMode.fullscreen; } + + /** * Set the scale factor. * * This can only be used in a GFX transaction. diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index e16a51762c..de9dba1ab1 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -324,11 +324,13 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() { SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + const bool isFullscreen = getFullscreenMode(); + // In case we have an fullscreen mode and we are not in a rollback, detect // a proper mode to use. In case we are in a rollback, we already detected // a proper mode when setting up that mode, thus there is no need to run // the detection again. - if (_videoMode.fullscreen && _transactionMode != kTransactionRollback) { + if (isFullscreen && _transactionMode != kTransactionRollback) { if (!setupFullscreenMode()) // Failed setuping a fullscreen mode return false; @@ -339,7 +341,7 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() { uint32 flags = SDL_OPENGL; - if (_videoMode.fullscreen) + if (isFullscreen) flags |= SDL_FULLSCREEN; else flags |= SDL_RESIZABLE; @@ -365,7 +367,7 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() { // Check if the screen is BGR format _formatBGR = _hwscreen->format->Rshift != 0; - if (_videoMode.fullscreen) { + if (isFullscreen) { _lastFullscreenModeWidth = _videoMode.hardwareWidth; _lastFullscreenModeHeight = _videoMode.hardwareHeight; ConfMan.setInt("last_fullscreen_mode_width", _lastFullscreenModeWidth); @@ -436,12 +438,14 @@ bool OpenGLSdlGraphicsManager::isHotkey(const Common::Event &event) { void OpenGLSdlGraphicsManager::toggleFullScreen(int loop) { beginGFXTransaction(); - if (_videoMode.fullscreen && loop) { + const bool isFullscreen = getFullscreenMode(); + + if (isFullscreen && loop) { _activeFullscreenMode += loop; setFullscreenMode(true); } else { _activeFullscreenMode = -2; - setFullscreenMode(!_videoMode.fullscreen); + setFullscreenMode(!isFullscreen); } endGFXTransaction(); @@ -450,7 +454,7 @@ void OpenGLSdlGraphicsManager::toggleFullScreen(int loop) { #ifdef USE_OSD char buffer[128]; - if (_videoMode.fullscreen) + if (getFullscreenMode()) sprintf(buffer, "Fullscreen mode\n%d x %d", _hwscreen->w, _hwscreen->h ); @@ -614,7 +618,7 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { // there is no common resize event. case OSystem_SDL::kSdlEventResize: // Do not resize if ignoring resize events. - if (!_ignoreResizeFrames && !_videoMode.fullscreen) { + if (!_ignoreResizeFrames && !getFullscreenMode()) { bool scaleChanged = false; beginGFXTransaction(); _videoMode.hardwareWidth = event.mouse.x; |