[Scummvm-git-logs] scummvm master -> 58c9005ef2b54dd727957eab1bffbdc1b7f597a8

bluegr noreply at scummvm.org
Thu Nov 21 01:17:59 UTC 2024


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:
58c9005ef2 BACKENDS: SDL: Never make window smaller in OpenGL mode when starting game


Commit: 58c9005ef2b54dd727957eab1bffbdc1b7f597a8
    https://github.com/scummvm/scummvm/commit/58c9005ef2b54dd727957eab1bffbdc1b7f597a8
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2024-11-21T03:17:56+02:00

Commit Message:
BACKENDS: SDL: Never make window smaller in OpenGL mode when starting game

Normally when using the OpenGL mode the window is not resized when
starting a game, unless the game requires a window bigger than the
current window size. However this was not the case if the engine
called initSizeHint() with sizes smaller than the current window
size, as in this case the window was forcibly resized to the bigger
of those provided sizes.

The initSizeHint() function was added for engines that use multiple
resolutions to indicate when starting the engine that it may use
multiple resolutions and thus may need a bigger window later than
when the game starts. This allows getting the bigger size from the
start and prevent window resize during gameplay. But this function
was not meant to make the window smaller if the graphics backend
request an even bigger size, which may be the case of the OpenGLSDL
graphics backend as it tries to preserve the current window size.

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


diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index 0e5554bdbf8..145e183e509 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -353,10 +353,10 @@ bool SdlGraphicsManager::createOrUpdateWindow(int width, int height, const Uint3
 		const bool fullscreen = (flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP)) != 0;
 		const bool maximized = (flags & SDL_WINDOW_MAXIMIZED);
 		if (!fullscreen && !maximized) {
-			if (_hintedWidth) {
+			if (_hintedWidth > width) {
 				width = _hintedWidth;
 			}
-			if (_hintedHeight) {
+			if (_hintedHeight > height) {
 				height = _hintedHeight;
 			}
 		}




More information about the Scummvm-git-logs mailing list