[Scummvm-git-logs] scummvm branch-2-7 -> fb8648c820af28fa2c9af6ab279cef15e7c428e2

criezy noreply at scummvm.org
Sun Feb 12 18:19:43 UTC 2023


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:
fb8648c820 SDL: Clip DPI scaling factor to ensure we get a reasonable value


Commit: fb8648c820af28fa2c9af6ab279cef15e7c428e2
    https://github.com/scummvm/scummvm/commit/fb8648c820af28fa2c9af6ab279cef15e7c428e2
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-02-12T18:16:31Z

Commit Message:
SDL: Clip DPI scaling factor to ensure we get a reasonable value

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


diff --git a/backends/platform/sdl/sdl-window.cpp b/backends/platform/sdl/sdl-window.cpp
index e9f78cc19e6..864bb2a45f2 100644
--- a/backends/platform/sdl/sdl-window.cpp
+++ b/backends/platform/sdl/sdl-window.cpp
@@ -24,6 +24,7 @@
 #include "backends/platform/sdl/sdl-window.h"
 
 #include "common/textconsole.h"
+#include "common/util.h"
 
 #include "icons/scummvm.xpm"
 
@@ -292,7 +293,9 @@ float SdlWindow::getDpiScalingFactor() const {
 	getDisplayDpi(&dpi, &defaultDpi);
 	debug(4, "dpi: %g default: %g", dpi, defaultDpi);
 	float ratio = dpi / defaultDpi;
-	return ratio;
+	// Getting the DPI can be unreliable, so clamp the scaling factor to make sure
+	// we do not return unreasonable values.
+	return CLIP(ratio, 1.0f, 4.0f);
 }
 
 float SdlWindow::getSdlDpiScalingFactor() const {




More information about the Scummvm-git-logs mailing list