aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2011-03-17 20:35:04 +0100
committerJohannes Schickel2011-03-17 21:20:20 +0100
commit8d35d91bdf3eab421233c6b971d6dec39b2f45b0 (patch)
tree0f9947f2f46780a1c5f08a67f94b9bb6a8cf647e
parentf490e6f361e55c2347b51611eb8f03a721630421 (diff)
downloadscummvm-rg350-8d35d91bdf3eab421233c6b971d6dec39b2f45b0.tar.gz
scummvm-rg350-8d35d91bdf3eab421233c6b971d6dec39b2f45b0.tar.bz2
scummvm-rg350-8d35d91bdf3eab421233c6b971d6dec39b2f45b0.zip
OPENGL: Cleanup switchDisplayMode.
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp20
-rw-r--r--backends/graphics/opengl/opengl-graphics.h5
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);