[Libreoffice-commits] core.git: svtools/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 26 10:50:21 UTC 2021


 svtools/source/config/optionsdrawinglayer.cxx |   41 ++++++++++++++++----------
 1 file changed, 26 insertions(+), 15 deletions(-)

New commits:
commit 57ee7deddd0934dab58199cb1d0b95439e2ba6b3
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 26 11:32:15 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 26 12:49:48 2021 +0200

    UBSAN fix
    
    after
        commit 28993c0a8d8628c650b661767fd8ab2228c507d9
        Author: Noel Grandin <noelgrandin at gmail.com>
        Date:   Sun Jul 25 15:05:51 2021 +0200
        use officecfg for drawing options
    
    I had the IsAAPossibleOnThisSystem() check inverted, and I didn't quite
    translate the existing IsAntiAliasing()/SetAntAliasing() logic correctly
    
    Fixes CppunitTest_sc_jumbosheets_test failure noted at
        https://gerrit.libreoffice.org/c/core/+/119481/5#message-747bde6ad4bdcf90d2ff51e8daa03cb0189e6355
    
    Change-Id: I5408da2e46f1f68646a74bd674b164ccfafdeb71
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119495
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx
index c615a2f6b6a0..43a1d68544f5 100644
--- a/svtools/source/config/optionsdrawinglayer.cxx
+++ b/svtools/source/config/optionsdrawinglayer.cxx
@@ -32,12 +32,6 @@
 namespace SvtOptionsDrawinglayer
 {
 
-// helper
-bool IsAAPossibleOnThisSystem()
-{
-    return !Application::GetDefaultDevice()->SupportsOperation( OutDevSupportType::TransparentRect );
-}
-
 bool IsOverlayBuffer()
 {
     return officecfg::Office::Common::Drawinglayer::OverlayBuffer::get();
@@ -126,19 +120,36 @@ sal_uInt32 GetMaximumPaperBottomMargin()
 }
 
 static std::mutex gaAntiAliasMutex;
-static bool bAntiAliasingInit = false;
-static bool bAntiAliasing = false;
+static bool gbAntiAliasingInit = false;
+static bool gbAntiAliasing = false;
+static bool gbAllowAAInit = false;
+static bool gbAllowAA = false;
 
-bool IsAntiAliasing()
+bool IsAAPossibleOnThisSystem()
 {
     std::lock_guard aGuard(gaAntiAliasMutex);
-    if (!bAntiAliasingInit)
+    if (!gbAllowAAInit)
+    {
+        gbAllowAAInit = true;
+        gbAllowAA = Application::GetDefaultDevice()->SupportsOperation( OutDevSupportType::TransparentRect );
+    }
+    return gbAllowAA;
+}
+
+
+bool IsAntiAliasing()
+{
+    bool bAntiAliasing;
     {
-        bAntiAliasingInit = true;
-        bAntiAliasing = officecfg::Office::Common::Drawinglayer::AntiAliasing::get()
-            && IsAAPossibleOnThisSystem();
+        std::lock_guard aGuard(gaAntiAliasMutex);
+        if (!gbAntiAliasingInit)
+        {
+            gbAntiAliasingInit = true;
+            gbAntiAliasing = officecfg::Office::Common::Drawinglayer::AntiAliasing::get();
+        }
+        bAntiAliasing = gbAntiAliasing;
     }
-    return bAntiAliasing;
+    return bAntiAliasing && IsAAPossibleOnThisSystem();
 }
 
 /**
@@ -156,7 +167,7 @@ void SetAntiAliasing( bool bOn, bool bTemporary )
         officecfg::Office::Common::Drawinglayer::AntiAliasing::set(bOn, batch);
         batch->commit();
     }
-    bAntiAliasing = bOn;
+    gbAntiAliasing = bOn;
 }
 
 


More information about the Libreoffice-commits mailing list