diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-01-28 09:39:48 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-01-28 10:43:09 +0100 |
commit | b3737c638671ab39c5e6aaeaf5426d102392cc0a (patch) | |
tree | 5d7ee4798ba55992e8f693e219a368bf1344ee38 | |
parent | 46984619f8b7fa30678b5c7ccd40a0d727a57ce5 (diff) |
Revert "tdf#138122 Detect window scaling for multi display configurations on macOS"
This reverts commit f318b856ed055f1952276355f811153f6b29c93e.
It appears this reliably causes CppunitTest_vcl_backend_test to fail on macOS on
at least tb69, see e.g. <https://ci.libreoffice.org/job/gerrit_mac/82587/
consoleFull#-500134232d893063f-7f3d-4b7e-b56f-4e0f225817cd> and
<https://ci.libreoffice.org/job/gerrit_mac/82592/
consoleFull#-500134232d893063f-7f3d-4b7e-b56f-4e0f225817cd>,
[_RUN_____] BackendTest::testDrawBlendExtended
/Users/tdf/lode/jenkins/workspace/lo_gerrit/Config/macosx_clang_dbgutil/vcl/qa/cppunit/BackendTest.cxx:688:BackendTest::testDrawBlendExtended
equality assertion failed
- Expected: c[000080ff]
- Actual : c[ffffffff]
BackendTest::testDrawBlendExtended finished in: 1ms
[_RUN_____] BackendTest::testDrawAlphaBitmapMirrored
/Users/tdf/lode/jenkins/workspace/lo_gerrit/Config/macosx_clang_dbgutil/vcl/qa/cppunit/BackendTest.cxx:749:BackendTest::testDrawAlphaBitmapMirrored
equality assertion failed
- Expected: c[ff0000ff]
- Actual : c[000000ff]
BackendTest::testDrawAlphaBitmapMirrored finished in: 1ms
[_RUN_____] BackendTest::testTdf124848
/Users/tdf/lode/jenkins/workspace/lo_gerrit/Config/macosx_clang_dbgutil/vcl/qa/cppunit/BackendTest.cxx:808:BackendTest::testTdf124848
equality assertion failed
- Expected: c[000000ff]
- Actual : c[ffffffff]
And it also causes my local macOS 11.1 ARM64 build to consistently fail that
way, both the original patch set 1 (with the older parent) and the submitted
patch set 2 (with a newer parent).
Change-Id: I2c36fada271e8bc300b6caa19370d8e8bb1e7599
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110055
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Jenkins
-rw-r--r-- | vcl/inc/quartz/salgdi.h | 1 | ||||
-rw-r--r-- | vcl/osx/salgdiutils.cxx | 50 | ||||
-rw-r--r-- | vcl/osx/salmacos.cxx | 2 | ||||
-rw-r--r-- | vcl/quartz/salgdi.cxx | 8 |
4 files changed, 36 insertions, 25 deletions
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 4897d96c6089..69b735787bdc 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -174,6 +174,7 @@ class AquaSalGraphics : public SalGraphics #ifdef MACOSX /// is this a window graphics bool mbWindow; + bool mbWindowScaling; #else // IOS diff --git a/vcl/osx/salgdiutils.cxx b/vcl/osx/salgdiutils.cxx index f3ddd946f699..01626d348999 100644 --- a/vcl/osx/salgdiutils.cxx +++ b/vcl/osx/salgdiutils.cxx @@ -35,35 +35,37 @@ #include <osx/salframe.h> #include <osx/saldata.hxx> -// TODO: Scale will be set to 2.0f as default after implementation of full scaled display support . This will allow moving of -// windows between non retina and retina displays without blurry text and graphics. Static variables have to be removed thereafter. +float AquaSalGraphics::GetWindowScaling() +{ + float fScale = 1.0f; -// Currently scaled display support is not implemented for bitmaps. This will cause a slight performance degradation on displays -// with single precision. To preserve performance for now, window scaling is only activated if at least one display with double -// precision is present. Moving windows between displays is then possible without blurry text and graphics too. Adapting window -// scaling when displays are added while application is running is not supported. +#ifdef MACOSX -static bool bWindowScaling = false; -static float fWindowScale = 1.0f; + // Window scaling independent from main display may be forced by setting VCL_MACOS_FORCE_WINDOW_SCALING environment variable + // whose setting is stored in mbWindowScaling. After implementation of full support of scaled displays window scaling will be + // set to 2.0f for macOS as default. This will allow moving of windows between non retina and retina displays without blurry + // text and graphics. -float AquaSalGraphics::GetWindowScaling() -{ - if (!bWindowScaling) + // TODO: After implementation of full support of scaled displays code has to be modified to set a scaling of 2.0f as default. + + if (mbWindowScaling) { - NSArray *aScreens = [NSScreen screens]; - if (aScreens != nullptr) - { - int nScreens = [aScreens count]; - for (int i = 0; i < nScreens; i++) - { - float fScale = [[aScreens objectAtIndex:i] backingScaleFactor]; - if (fScale > fWindowScale) - fWindowScale = fScale; - } - bWindowScaling = true; - } + fScale = 2.0f; + return fScale; + } + +#endif + + AquaSalFrame *pSalFrame = mpFrame; + if (!pSalFrame) + pSalFrame = static_cast<AquaSalFrame *>(GetSalData()->mpInstance->anyFrame()); + if (pSalFrame) + { + NSWindow *pNSWindow = pSalFrame->getNSWindow(); + if (pNSWindow) + fScale = [pNSWindow backingScaleFactor]; } - return fWindowScale; + return fScale; } void AquaSalGraphics::SetWindowGraphics( AquaSalFrame* pFrame ) diff --git a/vcl/osx/salmacos.cxx b/vcl/osx/salmacos.cxx index 5b1265130cd0..0f41dd9e8c4a 100644 --- a/vcl/osx/salmacos.cxx +++ b/vcl/osx/salmacos.cxx @@ -19,7 +19,7 @@ // This file contains the macOS-specific versions of the functions which were touched in the commit // to fix tdf#138122. The iOS-specific versions of these functions are kept (for now, when this -// comment is written) as they were before that commit in vcl/ios/salios.cxx. +// comment is written) as they were before that commit in vcl/isx/salios.cxx. #include <sal/config.h> #include <sal/log.hxx> diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index ae6a40cfd4e2..8dd9ec9222ad 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -205,6 +205,14 @@ AquaSalGraphics::AquaSalGraphics() , mbVirDev( false ) #ifdef MACOSX , mbWindow( false ) + + // Window scaling independent from main display may be forced by setting VCL_MACOS_FORCE_WINDOW_SCALING environment variable. If + // unset window scaling from main display will be used. After implementation of full support of scaled displays window scaling + // will be set to 2.0f for macOS as default. + + // TODO: After implementation of full support of scaled displays VCL_FORCE_WINDOW_SCALING control has to be removed. + + , mbWindowScaling( getenv("VCL_MACOS_FORCE_WINDOW_SCALING") ) #else , mbForeignContext( false ) #endif |