This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch AOO50X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit a631d4e42dbb4ec5e60d77e703f44c464b3a7222
Author: Jim Jagielski <[email protected]>
AuthorDate: Mon Nov 16 12:52:52 2026 -0500

    vcl: take only whole SAL_AQUA_BACKING_SCALE values from 1 to 4
    
    CGLayer rounds a fractional pixel size up, so a scale like 1.5 broke
    the XOR emulation and the virtual device size checks.
---
 main/vcl/aqua/source/window/salframe.cxx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/main/vcl/aqua/source/window/salframe.cxx 
b/main/vcl/aqua/source/window/salframe.cxx
index 794524a8cd..b59fbd02e2 100644
--- a/main/vcl/aqua/source/window/salframe.cxx
+++ b/main/vcl/aqua/source/window/salframe.cxx
@@ -25,7 +25,6 @@
 #include "precompiled_vcl.hxx"
 
 #include <string>
-#include <cmath>
 #include <cstdlib>
 
 #include "rtl/ustrbuf.hxx"
@@ -260,16 +259,17 @@ void AquaSalFrame::VCLToCocoa( NSPoint& io_rPoint, bool 
bRelativeToScreen )
 // -----------------------------------------------------------------------
 
 // SAL_AQUA_BACKING_SCALE=1 on a Retina screen (or =2 on a 1x one) tests the 
other scale
+// whole numbers only: CGLayer rounds a fractional pixel size up
 static float getBackingScaleOverride()
 {
     const char* pEnvStr = getenv( "SAL_AQUA_BACKING_SCALE" );
     if( !pEnvStr )
         return 0;
     char* pEnd = NULL;
-    const double fValue = strtod( pEnvStr, &pEnd );
-    if( pEnd == pEnvStr || *pEnd || !std::isfinite( fValue ) || fValue <= 0 )
+    const long nValue = strtol( pEnvStr, &pEnd, 10 );
+    if( pEnd == pEnvStr || *pEnd || nValue < 1 || nValue > 4 )
         return 0;
-    return static_cast<float>(fValue);
+    return static_cast<float>(nValue);
 }
 
 bool AquaSalFrame::UpdateBackingScale()

Reply via email to