summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2022-11-06 13:57:11 +0100
committerArmin Le Grand <Armin.Le.Grand@me.com>2022-11-08 11:16:30 +0100
commit444bf8710d5da7b584fbcb94693e4ed8d2e29297 (patch)
treeb785047790b44ae5b8ce4d3166d8edfe8f691568 /svtools
parentb9eaed7a4c484dde0b5c61b34b4beb60a101f661 (diff)
Update handling of AntiAliasing settings and processor2d
Currently SvtOptionsDrawinglayer::IsAntiAliasing() is used in the constructor of the VCL based processor2Ds to decide if AA is to be used or not. Using this inside the constructors makes it currently impossible to use a primitive renderer independent from these settings, except when changing these settings temporarily what may influence other renderings and is a hack. The setting SvtOptionsDrawinglayer::IsAntiAliasing() is intended to decide if LO shall use AA mode from user's perspective, this means for the EditViews of the Apps and some other occasions (previews, exports, conversions to bitmap, ...). This works currently since all visualizations for these purposes use newly constructed primitive renderers. But there is no way to use primitive renderers independent from that setting. For future renderers which might be used for other purposes this is not sufficient, there has to be a method to create a renderer using e.g. AA independent of the global setting. To allow that, move the deciding flag to the already used geometry::ViewInformation2D. To not change anything initially, use the global flag for now to init that default value at ViewInformation2D. I took the opportunity to adapt ViewInformation2D to no longer being read-only and not changeable, it uses internally an impl class based on cow_wrapper already anyways. Extending this would lead to the constructors getting even bigger, when usually only 1-3 values need to be changed and many usages want to copy an existing instance and modify it. Adapted that usages to a much smaller footprint. Up to this point this does not change anything, but move the usage of the SvtOptionsDrawinglayer to the defaults (constructors) of the involved class ViewInformation2D. Using this then in the primitive rederers should be safe and will allow to use a primitive renderer with or without AntiAliasing independent of the user setting, so also for non- EditView usages. Also already added the PixelSnapHairline setting, this will also be needed independent of user settings to have full freedom of usage. Unfortunately I cannot use SvtOptionsDrawinglayer methods ::IsAntiAliasing() or ::IsSnapHorVerLinesToDiscrete inside ViewInformation2D where I would need it. It's now in drawinglayercore and thus not linked against svtools (svt) anymore. Thus I have to do some forwarding mechanisms to get the correct values available in ViewInformation2D. Not nice, caused by creating drawinglayercore... Change-Id: I9f572ce67e5d86a242188bdc6d4ba7c9a12f6a9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142393 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/Library_svt.mk1
-rw-r--r--svtools/source/config/optionsdrawinglayer.cxx38
2 files changed, 37 insertions, 2 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index a2bc1aad7ccf..ec2405d65636 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -44,6 +44,7 @@ $(eval $(call gb_Library_use_libraries,svt,\
comphelper \
cppu \
cppuhelper \
+ drawinglayercore \
i18nlangtag \
i18nutil \
$(if $(ENABLE_JAVA), \
diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx
index 54efe4a66326..2fee81139800 100644
--- a/svtools/source/config/optionsdrawinglayer.cxx
+++ b/svtools/source/config/optionsdrawinglayer.cxx
@@ -22,6 +22,7 @@
#include <vcl/outdev.hxx>
#include <vcl/settings.hxx>
#include <officecfg/Office/Common.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <mutex>
// #i73602#
@@ -124,6 +125,12 @@ 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);
@@ -148,7 +155,18 @@ bool IsAntiAliasing()
}
bAntiAliasing = gbAntiAliasing;
}
- return bAntiAliasing && IsAAPossibleOnThisSystem();
+
+ bAntiAliasing = bAntiAliasing && IsAAPossibleOnThisSystem();
+
+ //
+ if (!gbAntiAliasingForwardInitial || gbAntiAliasingForwardLast != bAntiAliasing)
+ {
+ gbAntiAliasingForwardInitial = true;
+ gbAntiAliasingForwardLast = bAntiAliasing;
+ drawinglayer::geometry::ViewInformation2D::forwardAntiAliasing(bAntiAliasing);
+ }
+
+ return bAntiAliasing;
}
/**
@@ -165,6 +183,13 @@ void SetAntiAliasing( bool bOn, bool bTemporary )
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;
}
@@ -172,7 +197,16 @@ void SetAntiAliasing( bool bOn, bool bTemporary )
bool IsSnapHorVerLinesToDiscrete()
{
- return IsAntiAliasing() && officecfg::Office::Common::Drawinglayer::SnapHorVerLinesToDiscrete::get();
+ const bool bRetval(IsAntiAliasing() && officecfg::Office::Common::Drawinglayer::SnapHorVerLinesToDiscrete::get());
+
+ if (!gbPixelSnapHairlineForwardInitial || gbPixelSnapHairlineForwardLast != bRetval)
+ {
+ gbPixelSnapHairlineForwardInitial = true;
+ gbPixelSnapHairlineForwardLast = bRetval;
+ drawinglayer::geometry::ViewInformation2D::forwardPixelSnapHairline(bRetval);
+ }
+
+ return bRetval;
}
bool IsSolidDragCreate()