[Scummvm-cvs-logs] scummvm master -> 273a324a7111608329eea4ee2e8c0c3d1636aa7c

dhewg dhewg at wiibrew.org
Thu Feb 24 20:25:31 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
273a324a71 SDL: Prevent unnecessary gfx manager hotswap


Commit: 273a324a7111608329eea4ee2e8c0c3d1636aa7c
    https://github.com/scummvm/scummvm/commit/273a324a7111608329eea4ee2e8c0c3d1636aa7c
Author: dhewg (dhewg at wiibrew.org)
Date: 2011-02-24T11:24:58-08:00

Commit Message:
SDL: Prevent unnecessary gfx manager hotswap

Changed paths:
    backends/platform/sdl/sdl.cpp



diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index dc91bd9..0bc0119 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -125,10 +125,11 @@ void OSystem_SDL::init() {
 	if (_timerManager == 0)
 		_timerManager = new SdlTimerManager();
 
-	#ifdef USE_OPENGL
-		// Setup a list with both SDL and OpenGL graphics modes
-		setupGraphicsModes();
-	#endif
+#ifdef USE_OPENGL
+	// Setup a list with both SDL and OpenGL graphics modes
+	setupGraphicsModes();
+	_graphicsMode = _sdlModesCount;
+#endif
 }
 
 void OSystem_SDL::initBackend() {
@@ -464,6 +465,7 @@ int OSystem_SDL::getDefaultGraphicsMode() const {
 bool OSystem_SDL::setGraphicsMode(int mode) {
 	const OSystem::GraphicsMode *srcMode;
 	int i;
+
 	// Check if mode is from SDL or OpenGL
 	if (mode < _sdlModesCount) {
 		srcMode = SdlGraphicsManager::supportedGraphicsModes();
@@ -472,28 +474,34 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
 		srcMode = OpenGLSdlGraphicsManager::supportedGraphicsModes();
 		i = _sdlModesCount;
 	}
+
 	// Loop through modes
 	while (srcMode->name) {
 		if (i == mode) {
 			// If the new mode and the current mode are not from the same graphics
 			// manager, delete and create the new mode graphics manager
 			if (_graphicsMode >= _sdlModesCount && mode < _sdlModesCount) {
+				debug(1, "switching to plain SDL graphics");
 				delete _graphicsManager;
 				_graphicsManager = new SdlGraphicsManager(_eventSource);
 				((SdlGraphicsManager *)_graphicsManager)->initEventObserver();
 				_graphicsManager->beginGFXTransaction();
 			} else if (_graphicsMode < _sdlModesCount && mode >= _sdlModesCount) {
+				debug(1, "switching to OpenGL graphics");
 				delete _graphicsManager;
 				_graphicsManager = new OpenGLSdlGraphicsManager();
 				((OpenGLSdlGraphicsManager *)_graphicsManager)->initEventObserver();
 				_graphicsManager->beginGFXTransaction();
 			}
+
 			_graphicsMode = mode;
 			return _graphicsManager->setGraphicsMode(srcMode->id);
 		}
+
 		i++;
 		srcMode++;
 	}
+
 	return false;
 }
 






More information about the Scummvm-git-logs mailing list