[Scummvm-cvs-logs] scummvm master -> 0654a45c05e2b5345fa373027f73df092564ddfc

lordhoto lordhoto at gmail.com
Sat May 16 16:55:08 CEST 2015


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

Summary:
ed3a32a91a SDL: Check for NULL when listing available modes via SDL_ListModes
40e019efd4 SDL: Restore the original video mode when unloading the Surface graphics manager
0654a45c05 Merge pull request #596 from Templier/opengl_switch_crash


Commit: ed3a32a91ab9d1d1880034e1e09de3d16c17ed4a
    https://github.com/scummvm/scummvm/commit/ed3a32a91ab9d1d1880034e1e09de3d16c17ed4a
Author: Littleboy (littleboy at scummvm.org)
Date: 2015-05-15T23:30:02-04:00

Commit Message:
SDL: Check for NULL when listing available modes via SDL_ListModes

It can be returned when there are no dimensions available for the currently selected pixel format

Changed paths:
    backends/graphics/openglsdl/openglsdl-graphics.cpp



diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index c71b9c9..53868b8 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -57,7 +57,7 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint deskt
 	}
 #else
 	const SDL_Rect *const *availableModes = SDL_ListModes(NULL, SDL_OPENGL | SDL_FULLSCREEN);
-	if (availableModes != (void *)-1) {
+	if (availableModes != NULL && availableModes != (void *)-1) {
 		for (;*availableModes; ++availableModes) {
 			const SDL_Rect *mode = *availableModes;
 


Commit: 40e019efd45a02261a7dbc69ceaa9188d8c7a269
    https://github.com/scummvm/scummvm/commit/40e019efd45a02261a7dbc69ceaa9188d8c7a269
Author: Littleboy (littleboy at scummvm.org)
Date: 2015-05-16T01:29:15-04:00

Commit Message:
SDL: Restore the original video mode when unloading the Surface graphics manager

We set a custom video mode that might have a different BPP from the default. To ensure that other graphics managers will get the proper results when listing available video modes, we need to restore the initial BPP when unloading.

This fixes an issue when switching to OpenGL on Windows 8 and later. On those OSes, fullscreen OpenGL only has a 32bpp mode. It is correctly listed in the options but we call SLD_SetVideoMode later in the surface graphics manager. When we list the mode again after a switch, the internally selected BPP is still 16 and we fail to find any available fullscreen modes.

Changed paths:
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h



diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index d089253..d74a608 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -144,6 +144,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
 #ifdef USE_SDL_DEBUG_FOCUSRECT
 	_enableFocusRectDebugCode(false), _enableFocusRect(false), _focusRect(),
 #endif
+	_originalBitsPerPixel(0),
 	_transactionMode(kTransactionNone) {
 
 	// allocate palette storage
@@ -797,6 +798,12 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() {
 	} else
 #endif
 		{
+		// Save the original bpp to be able to restore the video mode on unload
+		if (_originalBitsPerPixel == 0) {
+			const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
+			_originalBitsPerPixel = videoInfo->vfmt->BitsPerPixel;
+		}
+
 		_hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16,
 			_videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
 			);
@@ -929,6 +936,11 @@ void SurfaceSdlGraphicsManager::unloadGFXMode() {
 	}
 #endif
 	DestroyScalers();
+
+	// Reset video mode to original
+	// This will ensure that any new graphic manager will use the initial BPP when listing available modes
+	if (_originalBitsPerPixel != 0)
+		SDL_SetVideoMode(_videoMode.screenWidth, _videoMode.screenHeight, _originalBitsPerPixel, _videoMode.fullscreen ? (SDL_FULLSCREEN | SDL_SWSURFACE) : SDL_SWSURFACE);
 }
 
 bool SurfaceSdlGraphicsManager::hotswapGFXMode() {
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 4ba15a3..2431ce8 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -236,6 +236,9 @@ protected:
 	};
 	VideoState _videoMode, _oldVideoMode;
 
+	// Original BPP to restore the video mode on unload
+	uint8 _originalBitsPerPixel;
+
 	/** Force full redraw on next updateScreen */
 	bool _forceFull;
 


Commit: 0654a45c05e2b5345fa373027f73df092564ddfc
    https://github.com/scummvm/scummvm/commit/0654a45c05e2b5345fa373027f73df092564ddfc
Author: Johannes Schickel (lordhoto at gmail.com)
Date: 2015-05-16T16:54:13+02:00

Commit Message:
Merge pull request #596 from Templier/opengl_switch_crash

Fix crash and wrong fullscreen mode listing when switching to OpenGL

Changed paths:
    backends/graphics/openglsdl/openglsdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h









More information about the Scummvm-git-logs mailing list