summaryrefslogtreecommitdiff
path: root/svx
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 /svx
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 'svx')
-rw-r--r--svx/source/dialog/pagectrl.cxx5
-rw-r--r--svx/source/dialog/weldeditview.cxx6
-rw-r--r--svx/source/sdr/contact/objectcontactofobjlistpainter.cxx10
-rw-r--r--svx/source/sdr/contact/objectcontactofpageview.cxx11
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofpageobj.cxx29
-rw-r--r--svx/source/sdr/overlay/overlaymanager.cxx19
-rw-r--r--svx/source/sdr/overlay/overlaymanagerbuffered.cxx2
7 files changed, 40 insertions, 42 deletions
diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx
index a55f6a2577cb..fe44562ff230 100644
--- a/svx/source/dialog/pagectrl.cxx
+++ b/svx/source/dialog/pagectrl.cxx
@@ -352,8 +352,9 @@ void SvxPageWindow::drawFillAttributes(vcl::RenderContext& rRenderContext,
if (aSequence.empty())
return;
- const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
- basegfx::B2DHomMatrix(), rRenderContext.GetViewTransformation(), aPaintRange, nullptr, 0.0);
+ drawinglayer::geometry::ViewInformation2D aViewInformation2D;
+ aViewInformation2D.setViewTransformation(rRenderContext.GetViewTransformation());
+ aViewInformation2D.setViewport(aPaintRange);
std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation2D));
diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx
index 3cfd53d707bb..a87168708ddb 100644
--- a/svx/source/dialog/weldeditview.cxx
+++ b/svx/source/dialog/weldeditview.cxx
@@ -231,9 +231,9 @@ void WeldEditView::DoPaint(vcl::RenderContext& rRenderContext, const tools::Rect
sdr::overlay::OverlaySelection aCursorOverlay(sdr::overlay::OverlayType::Transparent,
aHighlight, std::move(aLogicRanges), true);
- const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
- basegfx::B2DHomMatrix(), rRenderContext.GetViewTransformation(),
- vcl::unotools::b2DRectangleFromRectangle(rRect), nullptr, 0.0);
+ drawinglayer::geometry::ViewInformation2D aViewInformation2D;
+ aViewInformation2D.setViewTransformation(rRenderContext.GetViewTransformation());
+ aViewInformation2D.setViewport(vcl::unotools::b2DRectangleFromRectangle(rRect));
std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> xProcessor(
drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext,
diff --git a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
index ff65e60fcf7c..cef1cbc1f289 100644
--- a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
+++ b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
@@ -96,12 +96,10 @@ void ObjectContactOfObjListPainter::ProcessDisplay(DisplayInfo& rDisplayInfo)
}
// update local ViewInformation2D
- const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
- basegfx::B2DHomMatrix(),
- pTargetDevice->GetViewTransformation(),
- aViewRange,
- GetXDrawPageForSdrPage(const_cast< SdrPage* >(mpProcessedPage)),
- 0.0);
+ drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
+ aNewViewInformation2D.setViewTransformation(pTargetDevice->GetViewTransformation());
+ aNewViewInformation2D.setViewport(aViewRange);
+ aNewViewInformation2D.setVisualizedPage(GetXDrawPageForSdrPage(const_cast< SdrPage* >(mpProcessedPage)));
updateViewInformation2D(aNewViewInformation2D);
// collect primitive data in a sequence; this will already use the updated ViewInformation2D
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index fd8cf5b4a1ca..9d0918a5d22a 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -208,12 +208,11 @@ namespace sdr::contact
}
// update local ViewInformation2D
- const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
- basegfx::B2DHomMatrix(),
- rTargetOutDev.GetViewTransformation(),
- aViewRange,
- GetXDrawPageForSdrPage(GetSdrPage()),
- fCurrentTime);
+ drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
+ aNewViewInformation2D.setViewTransformation(rTargetOutDev.GetViewTransformation());
+ aNewViewInformation2D.setViewport(aViewRange);
+ aNewViewInformation2D.setVisualizedPage(GetXDrawPageForSdrPage(GetSdrPage()));
+ aNewViewInformation2D.setViewTime(fCurrentTime);
updateViewInformation2D(aNewViewInformation2D);
// if there is something to show, use a primitive processor to render it. There
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index d838a13c6eca..fb60e6b55965 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -124,20 +124,21 @@ drawinglayer::primitive2d::Primitive2DContainer PagePrimitiveExtractor::createPr
{
// update own ViewInformation2D for visualized page
const drawinglayer::geometry::ViewInformation2D& rOriginalViewInformation = mrViewObjectContactOfPageObj.GetObjectContact().getViewInformation2D();
- const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(
- rOriginalViewInformation.getObjectTransformation(),
- rOriginalViewInformation.getViewTransformation(),
-
- // #i101075# use empty range for page content here to force
- // the content not to be physically clipped in any way. This
- // would be possible, but would require the internal transformation
- // which maps between the page visualisation object and the page
- // content, including the aspect ratios (for details see in
- // PagePreviewPrimitive2D::create2DDecomposition)
- basegfx::B2DRange(),
-
- GetXDrawPageForSdrPage(pStartPage),
- 0.0); // no time; page previews are not animated
+ drawinglayer::geometry::ViewInformation2D aNewViewInformation2D(rOriginalViewInformation);
+
+ // #i101075# use empty range for page content here to force
+ // the content not to be physically clipped in any way. This
+ // would be possible, but would require the internal transformation
+ // which maps between the page visualisation object and the page
+ // content, including the aspect ratios (for details see in
+ // PagePreviewPrimitive2D::create2DDecomposition)
+ aNewViewInformation2D.setViewport(basegfx::B2DRange());
+
+ aNewViewInformation2D.setVisualizedPage(GetXDrawPageForSdrPage(pStartPage));
+
+ // no time; page previews are not animated
+ aNewViewInformation2D.setViewTime(0.0);
+
updateViewInformation2D(aNewViewInformation2D);
// create copy of DisplayInfo to set PagePainting
diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx
index c29138de8b87..21d3a5458cfa 100644
--- a/svx/source/sdr/overlay/overlaymanager.cxx
+++ b/svx/source/sdr/overlay/overlaymanager.cxx
@@ -46,7 +46,7 @@ namespace sdr::overlay
return;
const AntialiasingFlags nOriginalAA(rDestinationDevice.GetAntialiasing());
- const bool bIsAntiAliasing(SvtOptionsDrawinglayer::IsAntiAliasing());
+ const bool bIsAntiAliasing(getCurrentViewInformation2D().getUseAntiAliasing());
// tdf#150622 for High Contrast we typically force colors to a single pair Fore/Back,
// but it seems reasonable to allow overlays to use the selection color
// taken from the system High Contrast settings
@@ -137,8 +137,8 @@ namespace sdr::overlay
mnStripeLengthPixel(5),
mfDiscreteOne(0.0)
{
- // set Property 'ReducedDisplayQuality' to true to allow simpler interaction
- // visualisations
+ // Set Property 'ReducedDisplayQuality' to true to allow simpler interaction
+ // visualisations. Note: Currently will use reduced quality for 3d scene soft renderer
uno::Sequence< beans::PropertyValue > xProperties{
comphelper::makePropertyValue("ReducedDisplayQuality", true)
};
@@ -172,12 +172,11 @@ namespace sdr::overlay
OverlayManager* pThis = const_cast< OverlayManager* >(this);
pThis->maViewTransformation = getOutputDevice().GetViewTransformation();
- pThis->maViewInformation2D = drawinglayer::geometry::ViewInformation2D(
- maViewInformation2D.getObjectTransformation(),
- maViewTransformation,
- aViewRange,
- maViewInformation2D.getVisualizedPage(),
- maViewInformation2D.getViewTime());
+ drawinglayer::geometry::ViewInformation2D aViewInformation(maViewInformation2D);
+ aViewInformation.setViewTransformation(maViewTransformation);
+ aViewInformation.setViewport(aViewRange);
+ pThis->maViewInformation2D = aViewInformation;
+
pThis->mfDiscreteOne = 0.0;
}
@@ -296,7 +295,7 @@ namespace sdr::overlay
if (rRange.isEmpty()) {
return {};
}
- if (SvtOptionsDrawinglayer::IsAntiAliasing())
+ if (getCurrentViewInformation2D().getUseAntiAliasing())
{
// assume AA needs one pixel more and invalidate one pixel more
const double fDiscreteOne(getDiscreteOne());
diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
index 19babd089e54..365171757934 100644
--- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
+++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
@@ -412,7 +412,7 @@ namespace sdr::overlay
basegfx::B2DRange aDiscreteRange(rRange);
aDiscreteRange.transform(getOutputDevice().GetViewTransformation());
- if(SvtOptionsDrawinglayer::IsAntiAliasing())
+ if(getCurrentViewInformation2D().getUseAntiAliasing())
{
// assume AA needs one pixel more and invalidate one pixel more
const double fDiscreteOne(getDiscreteOne());