From: Ben Soares Date: Mon, 19 Apr 2021 15:37:24 +0000 (+0100) Subject: JAL-3833 cap the scaling used by HiDPISetting for incorrect DPI values or incorrect... X-Git-Tag: Release_2_11_1_5~10 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3838956bb8989cf00709b2746adf74e661146329;p=jalview.git JAL-3833 cap the scaling used by HiDPISetting for incorrect DPI values or incorrect height/width values --- diff --git a/src/jalview/bin/HiDPISetting.java b/src/jalview/bin/HiDPISetting.java index 497900f..ab5735d 100644 --- a/src/jalview/bin/HiDPISetting.java +++ b/src/jalview/bin/HiDPISetting.java @@ -35,6 +35,8 @@ public class HiDPISetting public static int scale = 0; + public final static int MAX_SCALE = 8; + private static boolean doneInit = false; private static boolean allowScalePropertyArg = false; @@ -147,6 +149,14 @@ public class HiDPISetting int dimensionScale = 1 + (mindimension / bigScreenThreshold); + // reject outrageous values -- dpiScale in particular could be mistaken + if (dpiScale > MAX_SCALE) { + dpiScale = 1; + } + if (dimensionScale > MAX_SCALE) { + dimensionScale = 1; + } + // choose larger of dimensionScale or dpiScale (most likely dimensionScale // as dpiScale often misreported) int autoScale = Math.max(dpiScale, dimensionScale);