aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/openglsdl
diff options
context:
space:
mode:
authorJohannes Schickel2015-12-11 19:23:41 +0100
committerJohannes Schickel2015-12-12 22:31:35 +0100
commitfe2ee9ecf5709d49279265f0e5d3b2d0a5688265 (patch)
treeac75a57549c0dd0d5020a423b2e8b03505f7d15f /backends/graphics/openglsdl
parent3232050dfc3283501b33881c762a5e9b188cf985 (diff)
downloadscummvm-rg350-fe2ee9ecf5709d49279265f0e5d3b2d0a5688265.tar.gz
scummvm-rg350-fe2ee9ecf5709d49279265f0e5d3b2d0a5688265.tar.bz2
scummvm-rg350-fe2ee9ecf5709d49279265f0e5d3b2d0a5688265.zip
OPENGL: Refactor screen refresh handling.
Subclasses of OpenGLGraphicsManager are now supposed to supply a refreshScreen function which handles actual screen updating (for example, buffer swapping).
Diffstat (limited to 'backends/graphics/openglsdl')
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp16
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.h2
2 files changed, 11 insertions, 7 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 42327197b7..892dfc6cd3 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -236,13 +236,6 @@ void OpenGLSdlGraphicsManager::updateScreen() {
}
OpenGLGraphicsManager::updateScreen();
-
- // Swap OpenGL buffers
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- SDL_GL_SwapWindow(_window->getSDLWindow());
-#else
- SDL_GL_SwapBuffers();
-#endif
}
void OpenGLSdlGraphicsManager::notifyVideoExpose() {
@@ -301,6 +294,15 @@ bool OpenGLSdlGraphicsManager::loadVideoMode(uint requestedWidth, uint requested
return setupMode(requestedWidth, requestedHeight);
}
+void OpenGLSdlGraphicsManager::refreshScreen() {
+ // Swap OpenGL buffers
+#if SDL_VERSION_ATLEAST(2, 0, 0)
+ SDL_GL_SwapWindow(_window->getSDLWindow());
+#else
+ SDL_GL_SwapBuffers();
+#endif
+}
+
bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
// In case we request a fullscreen mode we will use the mode the user
// has chosen last time or the biggest mode available.
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h
index 845880eb14..1552593575 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.h
+++ b/backends/graphics/openglsdl/openglsdl-graphics.h
@@ -65,6 +65,8 @@ protected:
virtual void setInternalMousePosition(int x, int y);
virtual bool loadVideoMode(uint requestedWidth, uint requestedHeight, const Graphics::PixelFormat &format);
+
+ virtual void refreshScreen();
private:
bool setupMode(uint width, uint height);