diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-28 12:32:19 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-28 16:29:56 +0200 |
commit | 424bdeda9fea09f0b48b5551baf872656845c7c3 (patch) | |
tree | 5ec62140bf0ccc00a7079a0af9cee71f4713818a /svtools | |
parent | a2756bf71a304f2bb1bf49753dfd37a3402bc463 (diff) |
Move all handling of AA allowing from svt to drawinglayer
Commit 444bf8710d5da7b584fbcb94693e4ed8d2e29297 (Update handling of
AntiAliasing settings and processor2d, 2022-11-08) moved the actual
variable holding the AA state to drawinglayer, which introduced a
duplication of the information.
This moves all the handling from svt to drawinglayer, so that svt
functions only use respective drawinglayer functions. Well, almost:
the IsAAPossibleOnThisSystem function needs vcl, so stays in svt.
Change-Id: I887307fbca1ca0cff1f5f32446e3599817099c3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151163
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/config/optionsdrawinglayer.cxx | 58 |
1 files changed, 7 insertions, 51 deletions
diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index 0564adffa94c..a4ec26ad921d 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -119,53 +119,25 @@ sal_uInt32 GetMaximumPaperBottomMargin() return officecfg::Office::Common::Drawinglayer::MaximumPaperBottomMargin::get(); } -static std::mutex gaAntiAliasMutex; -static bool gbAntiAliasingInit = false; -static bool gbAntiAliasing = false; -static bool gbAllowAAInit = false; -static bool gbAllowAA = false; - -static bool gbAntiAliasingForwardInitial(false); -static bool gbAntiAliasingForwardLast(true); - static bool gbPixelSnapHairlineForwardInitial(false); static bool gbPixelSnapHairlineForwardLast(true); bool IsAAPossibleOnThisSystem() { - std::scoped_lock aGuard(gaAntiAliasMutex); - if (!gbAllowAAInit) - { - gbAllowAAInit = true; - gbAllowAA = Application::GetDefaultDevice()->SupportsOperation( OutDevSupportType::TransparentRect ); - } + static const bool gbAllowAA + = Application::GetDefaultDevice()->SupportsOperation(OutDevSupportType::TransparentRect); return gbAllowAA; } bool IsAntiAliasing() { - bool bAntiAliasing; - { - std::scoped_lock aGuard(gaAntiAliasMutex); - if (!gbAntiAliasingInit) - { - gbAntiAliasingInit = true; - gbAntiAliasing = officecfg::Office::Common::Drawinglayer::AntiAliasing::get(); - } - bAntiAliasing = gbAntiAliasing; - } - - bAntiAliasing = bAntiAliasing && IsAAPossibleOnThisSystem(); - - // - if (!gbAntiAliasingForwardInitial || gbAntiAliasingForwardLast != bAntiAliasing) + bool bAntiAliasing = drawinglayer::geometry::ViewInformation2D::getGlobalAntiAliasing(); + if (bAntiAliasing && !IsAAPossibleOnThisSystem()) { - gbAntiAliasingForwardInitial = true; - gbAntiAliasingForwardLast = bAntiAliasing; - drawinglayer::geometry::ViewInformation2D::forwardAntiAliasing(bAntiAliasing); + drawinglayer::geometry::ViewInformation2D::setGlobalAntiAliasing(false, true); + bAntiAliasing = false; } - return bAntiAliasing; } @@ -176,23 +148,7 @@ bool IsAntiAliasing() */ void SetAntiAliasing( bool bOn, bool bTemporary ) { - std::scoped_lock aGuard(gaAntiAliasMutex); - if (!bTemporary) - { - std::shared_ptr<comphelper::ConfigurationChanges> batch = - comphelper::ConfigurationChanges::create(); - officecfg::Office::Common::Drawinglayer::AntiAliasing::set(bOn, batch); - batch->commit(); - } - - if (!gbAntiAliasingForwardInitial || gbAntiAliasingForwardLast != bOn) - { - gbAntiAliasingForwardInitial = true; - gbAntiAliasingForwardLast = bOn; - drawinglayer::geometry::ViewInformation2D::forwardAntiAliasing(bOn); - } - - gbAntiAliasing = bOn; + drawinglayer::geometry::ViewInformation2D::setGlobalAntiAliasing(bOn, bTemporary); } |