[Scummvm-git-logs] scummvm master -> b44c2d6322a3e27a4855001d358a266cf11f94b2

criezy noreply at scummvm.org
Thu Nov 21 23:01:56 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:
b44c2d6322 BACKENDS: SDL: Fix default scale factor used in initSizeHint


Commit: b44c2d6322a3e27a4855001d358a266cf11f94b2
    https://github.com/scummvm/scummvm/commit/b44c2d6322a3e27a4855001d358a266cf11f94b2
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2024-11-21T23:01:50Z

Commit Message:
BACKENDS: SDL: Fix default scale factor used in initSizeHint

The "scale_factor" setting can be -1, which means the default. But
instead it was hardcoded to 1, which is wrong for the SurfaceSDL
graphics mode where the default is 2.

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 145e183e509..8de597a29e4 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -166,10 +166,14 @@ void SdlGraphicsManager::initSizeHint(const Graphics::ModeList &modes) {
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 	const bool useDefault = defaultGraphicsModeConfig();
 
+	// This gets called from engine before they call initGraphics(), which means we cannot use getScaleFactor()
+	// because the scale factor in the backend has not yet been updated to use the game settings. So directly
+	// read the game settings. This may be -1, which means we want to use the default. Fortunately runGame()
+	// in main.cpp sets the gaphics mode (OpenGL or SurfaceSDL) before starting the engine. So we already have
+	// the correct graphics manager and we can call getDefaultScaleFactor() here.
 	int scale = ConfMan.getInt("scale_factor");
 	if (scale == -1) {
-		warning("Unknown scaler; defaulting to 1");
-		scale = 1;
+		scale = getDefaultScaleFactor();
 	}
 
 	int16 bestWidth = 0, bestHeight = 0;




More information about the Scummvm-git-logs mailing list