diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-26 11:32:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-26 12:49:48 +0200 |
commit | 57ee7deddd0934dab58199cb1d0b95439e2ba6b3 (patch) | |
tree | 639a381e38f7ae7df4a05a3f34be449edf95e6f3 /svtools/source/config | |
parent | 7458f19a254c799612795a0cddeb0910f71948d4 (diff) |
UBSAN fix
after
commit 28993c0a8d8628c650b661767fd8ab2228c507d9
Author: Noel Grandin <noelgrandin@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@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools/source/config')
-rw-r--r-- | svtools/source/config/optionsdrawinglayer.cxx | 41 |
1 files changed, 26 insertions, 15 deletions
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; } |