[Scummvm-cvs-logs] SF.net SVN: scummvm:[51047] scummvm/branches/gsoc2010-opengl/backends/ graphics/openglsdl

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Tue Jul 20 02:21:18 CEST 2010


Revision: 51047
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51047&view=rev
Author:   vgvgf
Date:     2010-07-20 00:21:17 +0000 (Tue, 20 Jul 2010)

Log Message:
-----------
OPENGL: Fix SDL OpenGL context not resizing well on Linux.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp	2010-07-19 23:58:48 UTC (rev 51046)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp	2010-07-20 00:21:17 UTC (rev 51047)
@@ -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 @@
 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 @@
 		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:

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h	2010-07-19 23:58:48 UTC (rev 51046)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h	2010-07-20 00:21:17 UTC (rev 51047)
@@ -65,6 +65,8 @@
 
 	// Hardware screen
 	SDL_Surface *_hwscreen;
+
+	bool _screenResized;
 };
 
 #endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list