[Scummvm-git-logs] scummvm master -> 8de1c2a4b87505e30b3b427e87a07d9cba2c3870

criezy noreply at scummvm.org
Sun Feb 12 18:15:53 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:
8de1c2a4b8 SDL: Clip DPI scaling factor to ensure we get a reasonable value


Commit: 8de1c2a4b87505e30b3b427e87a07d9cba2c3870
    https://github.com/scummvm/scummvm/commit/8de1c2a4b87505e30b3b427e87a07d9cba2c3870
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-02-12T19:15:49+01:00

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