diff options
| author | Alejandro Marzini | 2010-07-20 00:21:17 +0000 |
|---|---|---|
| committer | Alejandro Marzini | 2010-07-20 00:21:17 +0000 |
| commit | 014d7b791c03c0c754ebc2d4ef2f2a961420a63a (patch) | |
| tree | f181630358a5912b8203732e9db046ecfc34facc | |
| parent | f6e04fe03bfc5177229cf0ff29b850925cece2e1 (diff) | |
| download | scummvm-rg350-014d7b791c03c0c754ebc2d4ef2f2a961420a63a.tar.gz scummvm-rg350-014d7b791c03c0c754ebc2d4ef2f2a961420a63a.tar.bz2 scummvm-rg350-014d7b791c03c0c754ebc2d4ef2f2a961420a63a.zip | |
OPENGL: Fix SDL OpenGL context not resizing well on Linux.
svn-id: r51047
| -rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 19 | ||||
| -rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.h | 2 |
2 files changed, 15 insertions, 6 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index 8047ad9596..1eae7dd9c7 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -30,7 +30,8 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager() : - _hwscreen(0) { + _hwscreen(0), + _screenResized(false) { if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) { error("Could not initialize SDL: %s", SDL_GetError()); @@ -125,8 +126,11 @@ void OpenGLSdlGraphicsManager::warpMouse(int x, int y) { bool OpenGLSdlGraphicsManager::loadGFXMode() { _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; - _videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor; - _videoMode.hardwareHeight = _videoMode.screenHeight * _videoMode.scaleFactor; + if (!_screenResized) { + _videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor; + _videoMode.hardwareHeight = _videoMode.screenHeight * _videoMode.scaleFactor; + } + _screenResized = false; // Setup OpenGL attributes for SDL SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); @@ -279,9 +283,12 @@ bool OpenGLSdlGraphicsManager::notifyEvent(const Common::Event &event) { break;*/ // HACK: Handle special SDL event case OSystem_SDL::kSdlEventResize: - _videoMode.hardwareWidth = event.mouse.x; - _videoMode.hardwareHeight = event.mouse.y; - initGL(); + beginGFXTransaction(); + _videoMode.hardwareWidth = event.mouse.x; + _videoMode.hardwareHeight = event.mouse.y; + _screenResized = true; + _transactionDetails.sizeChanged = true; + endGFXTransaction(); return true; default: diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h index 4937e33eef..a9ee200ece 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/openglsdl/openglsdl-graphics.h @@ -65,6 +65,8 @@ protected: // Hardware screen SDL_Surface *_hwscreen; + + bool _screenResized; }; #endif |
