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

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

commit 5c1c065ac7b798e62c7a29f64975684c481cabb5
Author: Jim Jagielski <[email protected]>
AuthorDate: Mon Nov 16 12:20:24 2026 -0500

    vcl: let SAL_AQUA_BACKING_SCALE override the macOS backing scale
    
    For testing the 1x drawing paths on a Retina screen, or 2x on a 1x one.
---
 main/vcl/aqua/source/window/salframe.cxx | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/main/vcl/aqua/source/window/salframe.cxx 
b/main/vcl/aqua/source/window/salframe.cxx
index b3f6f3b90c..d7c4578372 100644
--- a/main/vcl/aqua/source/window/salframe.cxx
+++ b/main/vcl/aqua/source/window/salframe.cxx
@@ -25,6 +25,8 @@
 #include "precompiled_vcl.hxx"
 
 #include <string>
+#include <cmath>
+#include <cstdlib>
 
 #include "rtl/ustrbuf.hxx"
 
@@ -257,9 +259,25 @@ 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
+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 )
+        return 0;
+    return static_cast<float>(fValue);
+}
+
 bool AquaSalFrame::UpdateBackingScale()
 {
-    const float fScale = mpNSWindow ? [mpNSWindow backingScaleFactor] : 1.0f;
+    static const float fOverride = getBackingScaleOverride();
+    float fScale = mpNSWindow ? [mpNSWindow backingScaleFactor] : 1.0f;
+    if( fOverride > 0 )
+        fScale = fOverride;
     if( fScale == mfBackingScale )
         return false;
     mfBackingScale = fScale;

Reply via email to