diff options
Diffstat (limited to 'backends/graphics')
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 20 | ||||
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.h | 5 |
2 files changed, 14 insertions, 11 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 0729ff331c..e0c65dd309 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -1376,19 +1376,19 @@ const char *OpenGLGraphicsManager::getCurrentModeName() { } void OpenGLGraphicsManager::switchDisplayMode(int mode) { - if (_oldVideoMode.setup && _oldVideoMode.mode == mode) + assert(_transactionMode == kTransactionActive); + + if (_videoMode.mode == mode) return; - if (_transactionMode == kTransactionActive) { - if (mode == -1) // If -1, switch to next mode - _videoMode.mode = (_videoMode.mode + 1) % 4; - else if (mode == -2) // If -2, switch to previous mode - _videoMode.mode = (_videoMode.mode + 3) % 4; - else - _videoMode.mode = mode; + if (mode == -1) // If -1, switch to next mode + _videoMode.mode = (_videoMode.mode + 1) % 4; + else if (mode == -2) // If -2, switch to previous mode + _videoMode.mode = (_videoMode.mode + 3) % 4; + else + _videoMode.mode = mode; - _transactionDetails.needRefresh = true; - } + _transactionDetails.needRefresh = true; } #ifdef USE_OSD diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index 8432d8346c..f674015b4a 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -219,7 +219,10 @@ protected: /** * Sets the dispaly mode. - * @mode the dispaly mode, if -1 it will switch to next mode. If -2 to previous mode. + * + * This can only be used in a GFX transaction. + * + * @param mode the dispaly mode, if -1 it will switch to next mode. If -2 to previous mode. */ virtual void switchDisplayMode(int mode); |