[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore2' - 3 commits - drawinglayer/CppunitTest_drawinglayer_processors.mk drawinglayer/inc drawinglayer/Library_drawinglayer.mk drawinglayer/qa drawinglayer/source include/drawinginterface include/drawinglayer include/svx sc/source sd/source sfx2/source svgio/source svx/inc svx/source sw/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 24 07:19:25 UTC 2021
Rebased ref, commits from common ancestor:
commit 86b6ba7be8425a1bbb5872fc4bcbe6c2543aea67
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Aug 24 11:02:40 2021 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Tue Aug 24 16:18:28 2021 +0900
SVG export for drawinglayer primitives
Change-Id: I34e17eeb9695c9a8b23178611c149f89a28a210c
diff --git a/drawinglayer/CppunitTest_drawinglayer_processors.mk b/drawinglayer/CppunitTest_drawinglayer_processors.mk
index b17a5107dc2d..fd0eb0b365c1 100644
--- a/drawinglayer/CppunitTest_drawinglayer_processors.mk
+++ b/drawinglayer/CppunitTest_drawinglayer_processors.mk
@@ -38,6 +38,7 @@ $(eval $(call gb_CppunitTest_use_externals,drawinglayer_processors,\
$(eval $(call gb_CppunitTest_add_exception_objects,drawinglayer_processors, \
drawinglayer/qa/unit/vclmetafileprocessor2d \
drawinglayer/qa/unit/vclpixelprocessor2d \
+ drawinglayer/qa/unit/SvgExportTest \
))
$(eval $(call gb_CppunitTest_use_ure,drawinglayer_processors))
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index 6cee84ede118..8f2c99f1c12f 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -189,6 +189,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/texture/texture \
drawinglayer/source/dumper/XShapeDumper \
drawinglayer/source/dumper/EnhancedShapeDumper \
+ drawinglayer/source/tools/SvgWriter \
))
# vim: set noet sw=4 ts=4:
diff --git a/drawinglayer/qa/unit/SvgExportTest.cxx b/drawinglayer/qa/unit/SvgExportTest.cxx
new file mode 100644
index 000000000000..98198c2306e9
--- /dev/null
+++ b/drawinglayer/qa/unit/SvgExportTest.cxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <test/bootstrapfixture.hxx>
+
+#include <drawinglayer/tools/SvgWriter.hxx>
+
+#include <basegfx/range/b2drectangle.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+#include <drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx>
+
+using namespace drawinglayer;
+
+class SvgExportTest : public test::BootstrapFixture
+{
+public:
+ SvgExportTest()
+ : BootstrapFixture(true, false)
+ {
+ }
+
+ CPPUNIT_TEST_SUITE(SvgExportTest);
+ CPPUNIT_TEST(test);
+ CPPUNIT_TEST_SUITE_END();
+
+ void test()
+ {
+ SvFileStream aStream("~/test.svg", StreamMode::WRITE | StreamMode::TRUNC);
+
+ primitive2d::Primitive2DContainer aPrimitives;
+
+ basegfx::BColor aBColor(1.0, 0.0, 0.0);
+
+ auto aPolygon
+ = basegfx::utils::createPolygonFromRect(basegfx::B2DRectangle(10.0, 10.0, 50.0, 60.0));
+ basegfx::B2DPolyPolygon aPolyPolygon(aPolygon);
+
+ auto pStrokePrimitive(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(aPolyPolygon, aBColor));
+
+ aPrimitives.push_back(drawinglayer::primitive2d::Primitive2DReference(pStrokePrimitive));
+
+ svg::SvgWriter aWriter(aStream, svg::SvgVersion::v1_1);
+ aWriter.write(aPrimitives);
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SvgExportTest);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/tools/SvgWriter.cxx b/drawinglayer/source/tools/SvgWriter.cxx
new file mode 100644
index 000000000000..c0435d19a001
--- /dev/null
+++ b/drawinglayer/source/tools/SvgWriter.cxx
@@ -0,0 +1,211 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <memory>
+#include <sal/log.hxx>
+
+#include <drawinglayer/tools/SvgWriter.hxx>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/Tools.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <drawinglayer/primitive2d/PolyPolygonStrokePrimitive2D.hxx>
+#include <drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx>
+#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/objectinfoprimitive2d.hxx>
+#include <drawinglayer/primitive2d/svggradientprimitive2d.hxx>
+#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/fontattribute.hxx>
+
+#include <primitive2d/textlineprimitive2d.hxx>
+
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+
+namespace svg
+{
+SvgWriter::SvgWriter(SvStream& rStream, SvgVersion eSvgVersion)
+ : mrStream(rStream)
+ , maWriter(&mrStream)
+ , meSvgVersion(eSvgVersion)
+{
+}
+
+bool SvgWriter::write(const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence)
+{
+ maWriter.startDocument();
+ maWriter.startElement("svg");
+ OString aVersion = meSvgVersion == SvgVersion::v1_1 ? "1.1" : "2";
+ maWriter.attribute("version", aVersion);
+ maWriter.attribute("xmlns", "http://www.w3.org/2000/svg");
+
+ drawinglayer::primitive2d::VisitorParameters aParameters; // default
+
+ auto aRange = rPrimitive2DSequence.getB2DRange(aParameters);
+
+ maWriter.attribute("width", aRange.getWidth());
+ maWriter.attribute("height", aRange.getHeight());
+
+ decomposeAndWrite(rPrimitive2DSequence);
+
+ maWriter.endElement();
+ maWriter.endDocument();
+
+ return true;
+}
+
+void SvgWriter::decomposeAndWrite(
+ const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence)
+{
+ drawinglayer::primitive2d::VisitorParameters aVisitorParameters;
+
+ for (size_t i = 0; i < rPrimitive2DSequence.size(); i++)
+ {
+ auto xPrimitive2DReference = rPrimitive2DSequence[i];
+
+ const auto* pBasePrimitive
+ = dynamic_cast<const drawinglayer::primitive2d::BasePrimitive2D*>(
+ xPrimitive2DReference.get());
+
+ if (!pBasePrimitive)
+ continue;
+
+ sal_uInt32 nId = pBasePrimitive->getPrimitive2DID();
+
+ switch (nId)
+ {
+ case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D:
+ {
+ }
+ break;
+ case PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D:
+ {
+ ;
+ }
+ break;
+ case PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D:
+ {
+ }
+ break;
+ case PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D:
+ {
+ }
+ break;
+ case PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_GROUPPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_MASKPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_SVGRADIALGRADIENTPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_SVGLINEARGRADIENTPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D:
+ {
+ }
+ break;
+
+ case PRIMITIVE2D_ID_SHADOWPRIMITIVE2D:
+ {
+ }
+ break;
+
+ default:
+ {
+ }
+ break;
+ }
+ }
+}
+
+} // end namespace drawinglayer
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/tools/SvgWriter.hxx b/include/drawinglayer/tools/SvgWriter.hxx
new file mode 100644
index 000000000000..f4b23dde8e92
--- /dev/null
+++ b/include/drawinglayer/tools/SvgWriter.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <sal/config.h>
+#include <tools/stream.hxx>
+#include <tools/XmlWriter.hxx>
+
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+
+namespace svg
+{
+enum class SvgVersion
+{
+ v1_1,
+ v2
+};
+
+class DRAWINGLAYER_DLLPUBLIC SvgWriter
+{
+private:
+ SvStream& mrStream;
+ tools::XmlWriter maWriter;
+ SvgVersion meSvgVersion;
+
+ void
+ decomposeAndWrite(const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence);
+
+public:
+ SvgWriter(SvStream& rStream, SvgVersion eSvgVersion = SvgVersion::v1_1);
+ bool write(const drawinglayer::primitive2d::Primitive2DContainer& rPrimitive2DSequence);
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 686077b7b4d142def4532e71244d0dc2a1bfea53
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Aug 24 10:59:19 2021 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Tue Aug 24 16:18:28 2021 +0900
Introduce BasicPrimitive2D interface
Change-Id: I75e125e717038f10210ece291c94f46ac7e0ce89
diff --git a/include/drawinginterface/BasicPrimitive2D.hxx b/include/drawinginterface/BasicPrimitive2D.hxx
new file mode 100644
index 000000000000..b7ef8da101b8
--- /dev/null
+++ b/include/drawinginterface/BasicPrimitive2D.hxx
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+namespace drawinginterface
+{
+class BasicPrimitive2D
+{
+public:
+};
+
+class PolyPolygonBasicPrimitive : public BasicPrimitive2D
+{
+public:
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx b/include/drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx
index 55b9bfc87434..09bd5e6e39d4 100644
--- a/include/drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx
+++ b/include/drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx
@@ -21,6 +21,7 @@
#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinginterface/BasicPrimitive2D.hxx>
#include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/color/bcolor.hxx>
@@ -33,7 +34,9 @@ namespace drawinglayer::primitive2d
This is one of the non-decomposable primitives, so a renderer
should process it.
*/
-class DRAWINGLAYER_DLLPUBLIC PolyPolygonColorPrimitive2D final : public BasePrimitive2D
+class DRAWINGLAYER_DLLPUBLIC PolyPolygonColorPrimitive2D final
+ : public BasePrimitive2D,
+ public drawinginterface::PolyPolygonBasicPrimitive
{
private:
/// the tools::PolyPolygon geometry
commit 0757faf910da3bafe67611322b38cdb2b7ecc26d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Jan 2 20:52:36 2021 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Tue Aug 24 16:18:02 2021 +0900
make BasePrimitive2D easier extensible with VisitorParameters
BasePrimitive2D virtual methods get2DDecomposition and getB2DRange
are used in many subclasses of BasePrimitive2D. If we want to
extend the parameters that we want to pass to those classes (and
we will need to in the future changes) we need to change all the
subclasses too. So this commit intoduces VisitorParameters class,
which holds the parameters that we want to pass, which avoids the
need to extend the BasePrimitive2D API.
The only member of VisitorParameters is ViewInformation2D, which
was previously a parameter for both methods.
Change-Id: I39afc28707f1511aafce4e8a84dbc45b84fc8cd5
diff --git a/drawinglayer/inc/primitive2d/cropprimitive2d.hxx b/drawinglayer/inc/primitive2d/cropprimitive2d.hxx
index 86297687ad5f..6d291bde7902 100644
--- a/drawinglayer/inc/primitive2d/cropprimitive2d.hxx
+++ b/drawinglayer/inc/primitive2d/cropprimitive2d.hxx
@@ -82,7 +82,7 @@ namespace drawinglayer::primitive2d
virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
/// local decomposition
- virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const override;
/// provide unique ID
virtual sal_uInt32 getPrimitive2DID() const override;
diff --git a/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx b/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx
index ce62b3110199..dab9c349cbe4 100644
--- a/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx
+++ b/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx
@@ -57,9 +57,8 @@ private:
basegfx::B2DHomMatrix maLastObjectToViewTransformation;
/// create local decomposition
- virtual void
- create2DDecomposition(Primitive2DContainer& rContainer,
- const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer,
+ VisitorParameters const& rParameters) const override;
public:
/// constructor
@@ -80,16 +79,14 @@ public:
by a fixed discrete unit, thus the contained geometry needs only once be asked for its
own basegfx::B2DRange
*/
- virtual basegfx::B2DRange
- getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual basegfx::B2DRange getB2DRange(VisitorParameters const& rParameters) const override;
/// provide unique ID
virtual sal_uInt32 getPrimitive2DID() const override;
/// Override standard getDecomposition to be view-dependent here
- virtual void
- get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
- const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ VisitorParameters const& rParameters) const override;
};
} // end of namespace primitive2d::drawinglayer
diff --git a/drawinglayer/inc/primitive2d/textlineprimitive2d.hxx b/drawinglayer/inc/primitive2d/textlineprimitive2d.hxx
index 423be7995879..e8038d7e2356 100644
--- a/drawinglayer/inc/primitive2d/textlineprimitive2d.hxx
+++ b/drawinglayer/inc/primitive2d/textlineprimitive2d.hxx
@@ -41,7 +41,7 @@ namespace drawinglayer::primitive2d
basegfx::BColor maLineColor;
/// local decomposition.
- virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const override;
public:
/// constructor
diff --git a/drawinglayer/inc/primitive2d/textstrikeoutprimitive2d.hxx b/drawinglayer/inc/primitive2d/textstrikeoutprimitive2d.hxx
index 9b93e28dbe0d..03a95ea406c1 100644
--- a/drawinglayer/inc/primitive2d/textstrikeoutprimitive2d.hxx
+++ b/drawinglayer/inc/primitive2d/textstrikeoutprimitive2d.hxx
@@ -68,7 +68,7 @@ namespace drawinglayer::primitive2d
css::lang::Locale maLocale;
/// local decomposition.
- virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const override;
public:
/// constructor
@@ -105,7 +105,7 @@ namespace drawinglayer::primitive2d
TextStrikeout meTextStrikeout;
/// local decomposition.
- virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const override;
public:
/// constructor
diff --git a/drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx b/drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx
index c92006b36db3..7319575d4456 100644
--- a/drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx
+++ b/drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx
@@ -47,7 +47,7 @@ namespace drawinglayer::primitive2d
WallpaperStyle meWallpaperStyle;
/// create local decomposition
- virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const override;
public:
/// constructor
@@ -65,7 +65,7 @@ namespace drawinglayer::primitive2d
virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
/// get B2Drange
- virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual basegfx::B2DRange getB2DRange(VisitorParameters const & rParameters) const override;
/// provide unique ID
virtual sal_uInt32 getPrimitive2DID() const override;
diff --git a/drawinglayer/qa/unit/border.cxx b/drawinglayer/qa/unit/border.cxx
index a3f7029b7350..b688defa9f94 100644
--- a/drawinglayer/qa/unit/border.cxx
+++ b/drawinglayer/qa/unit/border.cxx
@@ -66,9 +66,10 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoubleDecompositionSolid)
aStrokeAttribute));
// Decompose it into polygons.
- drawinglayer::geometry::ViewInformation2D aView;
+ const drawinglayer::geometry::ViewInformation2D aView;
+ const drawinglayer::primitive2d::VisitorParameters aVisitorParameters(aView);
drawinglayer::primitive2d::Primitive2DContainer aContainer;
- aBorder->get2DDecomposition(aContainer, aView);
+ aBorder->get2DDecomposition(aContainer, aVisitorParameters);
// Make sure it results in two borders as it's a double one.
CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(2), aContainer.size());
@@ -91,8 +92,9 @@ CPPUNIT_TEST_FIXTURE(DrawinglayerBorderTest, testDoublePixelProcessing)
// Create a pixel processor.
ScopedVclPtrInstance<VirtualDevice> pDev;
drawinglayer::geometry::ViewInformation2D aView;
- std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
- drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(*pDev, aView));
+ const drawinglayer::primitive2d::VisitorParameters aVisitorParameters(aView);
+ auto pProcessor = drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(
+ *pDev, aVisitorParameters);
CPPUNIT_ASSERT(pProcessor);
GDIMetaFile aMetaFile;
// Start recording after the processor is created, so we can test the pixel processor.
diff --git a/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx b/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx
index 28112e61647b..44803d3917db 100644
--- a/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/qa/unit/vclmetafileprocessor2d.cxx
@@ -85,10 +85,12 @@ public:
metafile.SetPrefSize(Size(14548, 3350));
ScopedVclPtrInstance<VirtualDevice> metadevice;
metafile.Record(metadevice);
- drawinglayer::geometry::ViewInformation2D view;
- std::unique_ptr<processor2d::BaseProcessor2D> processor(
- processor2d::createBaseProcessor2DFromOutputDevice(*metadevice, view));
+
+ drawinglayer::primitive2d::VisitorParameters aParameters;
+ auto processor
+ = processor2d::createBaseProcessor2DFromOutputDevice(*metadevice, aParameters);
CPPUNIT_ASSERT(processor);
+
// Match the values Impress uses.
basegfx::B2DPolygon polygon = { { 15601, 0 }, { 15602, 5832 } };
attribute::LineAttribute lineAttributes(
diff --git a/drawinglayer/qa/unit/vclpixelprocessor2d.cxx b/drawinglayer/qa/unit/vclpixelprocessor2d.cxx
index 17ef17969fe4..33d4c676db49 100644
--- a/drawinglayer/qa/unit/vclpixelprocessor2d.cxx
+++ b/drawinglayer/qa/unit/vclpixelprocessor2d.cxx
@@ -51,9 +51,8 @@ public:
device->SetBackground(Wallpaper(COL_RED));
device->Erase();
- drawinglayer::geometry::ViewInformation2D view;
- std::unique_ptr<processor2d::BaseProcessor2D> processor(
- processor2d::createBaseProcessor2DFromOutputDevice(*device, view));
+ drawinglayer::primitive2d::VisitorParameters aParameters;
+ auto processor = processor2d::createBaseProcessor2DFromOutputDevice(*device, aParameters);
CPPUNIT_ASSERT(processor);
basegfx::B2DRange definitionRange(0, 0, 100, 200);
diff --git a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
index 98ca81433f12..b8e599c87b17 100644
--- a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
+++ b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
@@ -118,6 +118,7 @@ namespace drawinglayer::unorenderer
}
const auto aViewInformation2D = geometry::createViewInformation2D(aViewInformationSequence);
+ primitive2d::VisitorParameters aVisitorParameters(aViewInformation2D);
const sal_uInt32 nDiscreteWidth(basegfx::fround(o3tl::convert(fWidth, eRangeUnit, o3tl::Length::in) * DPI_X));
const sal_uInt32 nDiscreteHeight(basegfx::fround(o3tl::convert(fHeight, eRangeUnit, o3tl::Length::in) * DPI_Y));
@@ -139,7 +140,7 @@ namespace drawinglayer::unorenderer
BitmapEx aBitmapEx(
convertToBitmapEx(
xEmbedSeq,
- aViewInformation2D,
+ aVisitorParameters,
nDiscreteWidth,
nDiscreteHeight,
MaximumQuadraticPixels));
diff --git a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
index c352c70c6d39..a925c0992255 100644
--- a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
@@ -34,17 +34,16 @@ BufferedDecompositionPrimitive2D::BufferedDecompositionPrimitive2D()
}
void BufferedDecompositionPrimitive2D::get2DDecomposition(
- Primitive2DDecompositionVisitor& rVisitor,
- const geometry::ViewInformation2D& rViewInformation) const
+ Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const& rParameters) const
{
::osl::MutexGuard aGuard(m_aMutex);
if (getBuffered2DDecomposition().empty())
{
Primitive2DContainer aNewSequence;
- create2DDecomposition(aNewSequence, rViewInformation);
- const_cast<BufferedDecompositionPrimitive2D*>(this)->setBuffered2DDecomposition(
- aNewSequence);
+ create2DDecomposition(aNewSequence, rParameters);
+ auto* pMutableThis = const_cast<BufferedDecompositionPrimitive2D*>(this);
+ pMutableThis->setBuffered2DDecomposition(aNewSequence);
}
rVisitor.append(getBuffered2DDecomposition());
diff --git a/drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx
index aa48a965e692..6896a91b4aa6 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx
@@ -48,8 +48,8 @@ bool PolyPolygonColorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive)
return false;
}
-basegfx::B2DRange PolyPolygonColorPrimitive2D::getB2DRange(
- const geometry::ViewInformation2D& /*rViewInformation*/) const
+basegfx::B2DRange
+PolyPolygonColorPrimitive2D::getB2DRange(VisitorParameters const& /*rParameters*/) const
{
// return range
return basegfx::utils::getRange(getB2DPolyPolygon());
diff --git a/drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D.cxx
index cbf9e8902bb0..40aa40ce8149 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D.cxx
@@ -29,7 +29,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonGradientPrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitorParameters const& /*rParameters*/) const
{
if (!getFillGradient().isDefault())
{
diff --git a/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
index c857ba5c8e3d..a19de6f4686b 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
@@ -31,7 +31,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonGraphicPrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitorParameters const& /*rParameters*/) const
{
if (getFillGraphic().isDefault())
return;
diff --git a/drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D.cxx
index e4c73f9191a5..5d859a6f6bfa 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D.cxx
@@ -28,7 +28,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonHairlinePrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitorParameters const& /*rParameters*/) const
{
const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
const sal_uInt32 nCount(aPolyPolygon.count());
@@ -65,8 +65,8 @@ bool PolyPolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitiv
return false;
}
-basegfx::B2DRange PolyPolygonHairlinePrimitive2D::getB2DRange(
- const geometry::ViewInformation2D& /*rViewInformation*/) const
+basegfx::B2DRange
+PolyPolygonHairlinePrimitive2D::getB2DRange(VisitorParameters const& /*rParameters*/) const
{
// return range
return basegfx::utils::getRange(getB2DPolyPolygon());
diff --git a/drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D.cxx
index dd0495739fec..80eab7edcbc9 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D.cxx
@@ -29,7 +29,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonHatchPrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitorParameters const& /*rParameters*/) const
{
if (!getFillHatch().isDefault())
{
diff --git a/drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D.cxx
index b545ec9465fa..a8c922471eb8 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D.cxx
@@ -28,7 +28,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonMarkerPrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitorParameters const& /*rParameters*/) const
{
const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
const sal_uInt32 nCount(aPolyPolygon.count());
@@ -71,8 +71,8 @@ bool PolyPolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive)
return false;
}
-basegfx::B2DRange PolyPolygonMarkerPrimitive2D::getB2DRange(
- const geometry::ViewInformation2D& /*rViewInformation*/) const
+basegfx::B2DRange
+PolyPolygonMarkerPrimitive2D::getB2DRange(VisitorParameters const& /*rParameters*/) const
{
// return range
return basegfx::utils::getRange(getB2DPolyPolygon());
diff --git a/drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx
index 7be684c2f71e..9a374632a6e0 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx
@@ -31,7 +31,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonSelectionPrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitorParameters const& /*rParameters*/) const
{
if (getTransparence() >= 1.0 || !getB2DPolyPolygon().count())
return;
@@ -97,8 +97,8 @@ bool PolyPolygonSelectionPrimitive2D::operator==(const BasePrimitive2D& rPrimiti
return false;
}
-basegfx::B2DRange PolyPolygonSelectionPrimitive2D::getB2DRange(
- const geometry::ViewInformation2D& rViewInformation) const
+basegfx::B2DRange
+PolyPolygonSelectionPrimitive2D::getB2DRange(VisitorParameters const& rParameters) const
{
basegfx::B2DRange aRetval(basegfx::utils::getRange(getB2DPolyPolygon()));
@@ -106,7 +106,8 @@ basegfx::B2DRange PolyPolygonSelectionPrimitive2D::getB2DRange(
{
// get the current DiscreteUnit (not sure if getDiscreteUnit() is updated here, better go safe way)
const double fDiscreteUnit(
- (rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0))
+ (rParameters.getViewInformation().getInverseObjectToViewTransformation()
+ * basegfx::B2DVector(1.0, 0.0))
.getLength());
aRetval.grow(fDiscreteUnit * getDiscreteGrow());
diff --git a/drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D.cxx
index 53abec1138c3..226b8a28c103 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D.cxx
@@ -28,7 +28,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonStrokePrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitorParameters const& /*rParameters*/) const
{
const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
const sal_uInt32 nCount(aPolyPolygon.count());
@@ -77,8 +77,8 @@ bool PolyPolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive)
return false;
}
-basegfx::B2DRange PolyPolygonStrokePrimitive2D::getB2DRange(
- const geometry::ViewInformation2D& /*rViewInformation*/) const
+basegfx::B2DRange
+PolyPolygonStrokePrimitive2D::getB2DRange(VisitorParameters const& /*rParameters*/) const
{
// get range of it (subdivided)
basegfx::B2DRange aRetval(basegfx::utils::getRange(getB2DPolyPolygon()));
diff --git a/drawinglayer/source/primitive2d/Primitive2DContainer.cxx b/drawinglayer/source/primitive2d/Primitive2DContainer.cxx
index 3ae4a9b3e3c4..02c72f030b2a 100644
--- a/drawinglayer/source/primitive2d/Primitive2DContainer.cxx
+++ b/drawinglayer/source/primitive2d/Primitive2DContainer.cxx
@@ -48,8 +48,7 @@ Primitive2DContainer Primitive2DContainer::maybeInvert(bool bInvert) const
}
// get B2DRange from a given Primitive2DSequence
-basegfx::B2DRange
-Primitive2DContainer::getB2DRange(const geometry::ViewInformation2D& aViewInformation) const
+basegfx::B2DRange Primitive2DContainer::getB2DRange(VisitorParameters const& rParameters) const
{
basegfx::B2DRange aRetval;
@@ -59,7 +58,7 @@ Primitive2DContainer::getB2DRange(const geometry::ViewInformation2D& aViewInform
for (sal_Int32 a(0); a < nCount; a++)
{
- aRetval.expand(getB2DRangeFromPrimitive2DReference((*this)[a], aViewInformation));
+ aRetval.expand(getB2DRangeFromPrimitive2DReference((*this)[a], rParameters));
}
}
diff --git a/drawinglayer/source/primitive2d/Tools.cxx b/drawinglayer/source/primitive2d/Tools.cxx
index 45b2a993b3a7..68832bfd509d 100644
--- a/drawinglayer/source/primitive2d/Tools.cxx
+++ b/drawinglayer/source/primitive2d/Tools.cxx
@@ -28,9 +28,8 @@ using namespace css;
namespace drawinglayer::primitive2d
{
// get B2DRange from a given Primitive2DReference
-basegfx::B2DRange
-getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate,
- const geometry::ViewInformation2D& aViewInformation)
+basegfx::B2DRange getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate,
+ VisitorParameters const& rParameters)
{
basegfx::B2DRange aRetval;
@@ -38,7 +37,7 @@ getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate,
{
// get C++ implementation base
const BasePrimitive2D* pCandidate(static_cast<BasePrimitive2D*>(rCandidate.get()));
- aRetval.expand(pCandidate->getB2DRange(aViewInformation));
+ aRetval.expand(pCandidate->getB2DRange(rParameters));
}
return aRetval;
diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
index 827e9b81d05d..f20bf4e7c300 100644
--- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
@@ -62,12 +62,12 @@ namespace drawinglayer::primitive2d
return false;
}
- void AnimatedSwitchPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void AnimatedSwitchPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
if(getChildren().empty())
return;
- const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime()));
+ const double fState(getAnimationEntry().getStateAtTime(rParameters.getViewInformation().getViewTime()));
const sal_uInt32 nLen(getChildren().size());
sal_uInt32 nIndex(basegfx::fround(fState * static_cast<double>(nLen)));
@@ -98,11 +98,11 @@ namespace drawinglayer::primitive2d
{
}
- void AnimatedBlinkPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void AnimatedBlinkPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
if(!getChildren().empty())
{
- const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime()));
+ const double fState(getAnimationEntry().getStateAtTime(rParameters.getViewInformation().getViewTime()));
if(fState < 0.5)
{
@@ -139,13 +139,13 @@ namespace drawinglayer::primitive2d
}
}
- void AnimatedInterpolatePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void AnimatedInterpolatePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
const sal_uInt32 nSize(maMatrixStack.size());
if(nSize)
{
- double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime()));
+ double fState(getAnimationEntry().getStateAtTime(rParameters.getViewInformation().getViewTime()));
if(fState < 0.0)
{
diff --git a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
index e05b4b9cb239..f2e96bdf602d 100644
--- a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
@@ -30,8 +30,10 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void BackgroundColorPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void BackgroundColorPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const
{
+ auto const & rViewInformation = rParameters.getViewInformation();
+
if(!rViewInformation.getViewport().isEmpty())
{
const basegfx::B2DPolygon aOutline(basegfx::utils::createPolygonFromRect(rViewInformation.getViewport()));
@@ -61,17 +63,17 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange BackgroundColorPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ basegfx::B2DRange BackgroundColorPrimitive2D::getB2DRange(VisitorParameters const & rParameters) const
{
// always as big as the view
- return rViewInformation.getViewport();
+ return rParameters.getViewInformation().getViewport();
}
- void BackgroundColorPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void BackgroundColorPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
::osl::MutexGuard aGuard( m_aMutex );
- if(!getBuffered2DDecomposition().empty() && (maLastViewport != rViewInformation.getViewport()))
+ if(!getBuffered2DDecomposition().empty() && (maLastViewport != rParameters.getViewInformation().getViewport()))
{
// conditions of last local decomposition have changed, delete
const_cast< BackgroundColorPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer());
@@ -80,11 +82,11 @@ namespace drawinglayer::primitive2d
if(getBuffered2DDecomposition().empty())
{
// remember ViewRange
- const_cast< BackgroundColorPrimitive2D* >(this)->maLastViewport = rViewInformation.getViewport();
+ const_cast< BackgroundColorPrimitive2D* >(this)->maLastViewport = rParameters.getViewInformation().getViewport();
}
// use parent implementation
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
// provide unique ID
diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index 61cd0923ad3d..052e6ab7fab4 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -48,38 +48,40 @@ namespace
class B2DRangeVisitor : public Primitive2DDecompositionVisitor
{
public:
- const geometry::ViewInformation2D& mrViewInformation;
+ VisitorParameters const& mrParameters;
basegfx::B2DRange maRetval;
- B2DRangeVisitor(const geometry::ViewInformation2D& rViewInformation)
- : mrViewInformation(rViewInformation)
+
+ B2DRangeVisitor(VisitorParameters const& rParameters)
+ : mrParameters(rParameters)
{
}
- virtual void append(const Primitive2DReference& r) override
+
+ virtual void append(const Primitive2DReference& rReference) override
{
- maRetval.expand(getB2DRangeFromPrimitive2DReference(r, mrViewInformation));
+ maRetval.expand(getB2DRangeFromPrimitive2DReference(rReference, mrParameters));
}
- virtual void append(const Primitive2DContainer& r) override
+
+ virtual void append(const Primitive2DContainer& rReference) override
{
- maRetval.expand(r.getB2DRange(mrViewInformation));
+ maRetval.expand(rReference.getB2DRange(mrParameters));
}
- virtual void append(Primitive2DContainer&& r) override
+
+ virtual void append(Primitive2DContainer&& rReference) override
{
- maRetval.expand(r.getB2DRange(mrViewInformation));
+ maRetval.expand(rReference.getB2DRange(mrParameters));
}
};
}
-basegfx::B2DRange
-BasePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+basegfx::B2DRange BasePrimitive2D::getB2DRange(VisitorParameters const& rParameters) const
{
- B2DRangeVisitor aVisitor(rViewInformation);
- get2DDecomposition(aVisitor, rViewInformation);
+ B2DRangeVisitor aVisitor(rParameters);
+ get2DDecomposition(aVisitor, rParameters);
return aVisitor.maRetval;
}
-void BasePrimitive2D::get2DDecomposition(
- Primitive2DDecompositionVisitor& /*rVisitor*/,
- const geometry::ViewInformation2D& /*rViewInformation*/) const
+void BasePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& /*rVisitor*/,
+ VisitorParameters const& /*rParameters*/) const
{
}
@@ -88,7 +90,8 @@ BasePrimitive2D::getDecomposition(const uno::Sequence<beans::PropertyValue>& rVi
{
const auto aViewInformation = geometry::createViewInformation2D(rViewParameters);
Primitive2DContainer aContainer;
- get2DDecomposition(aContainer, aViewInformation);
+ VisitorParameters aParameters(aViewInformation);
+ get2DDecomposition(aContainer, aParameters);
return comphelper::containerToSequence(aContainer);
}
@@ -96,7 +99,8 @@ css::geometry::RealRectangle2D SAL_CALL
BasePrimitive2D::getRange(const uno::Sequence<beans::PropertyValue>& rViewParameters)
{
const auto aViewInformation = geometry::createViewInformation2D(rViewParameters);
- return basegfx::unotools::rectangle2DFromB2DRectangle(getB2DRange(aViewInformation));
+ VisitorParameters aParameters(aViewInformation);
+ return basegfx::unotools::rectangle2DFromB2DRectangle(getB2DRange(aParameters));
}
sal_Int64 SAL_CALL BasePrimitive2D::estimateUsage()
diff --git a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
index 0848193d3c65..c93db9887c58 100644
--- a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
@@ -45,8 +45,7 @@ bool BitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
return false;
}
-basegfx::B2DRange
-BitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+basegfx::B2DRange BitmapPrimitive2D::getB2DRange(VisitorParameters const& /*rParameters*/) const
{
basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
aRetval.transform(maTransform);
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index e1e6002c35cf..8b5a9dace119 100644
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -112,7 +112,7 @@ namespace drawinglayer::primitive2d
return fRetval;
}
- void BorderLinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void BorderLinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & /*rParameters*/) const
{
if (getStart().equal(getEnd()) || getBorderLines().empty())
return;
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index 5421a696742b..ae4e1fd769bf 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -75,11 +75,13 @@ namespace drawinglayer::primitive2d
}
}
- Primitive2DReference ControlPrimitive2D::createBitmapDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ Primitive2DReference ControlPrimitive2D::createBitmapDecomposition(VisitorParameters const & rParameters) const
{
Primitive2DReference xRetval;
const uno::Reference< awt::XControl >& rXControl(getXControl());
+ auto const & rViewInformation = rParameters.getViewInformation();
+
if(rXControl.is())
{
uno::Reference< awt::XWindow > xControlWindow(rXControl, uno::UNO_QUERY);
@@ -226,11 +228,11 @@ namespace drawinglayer::primitive2d
return xRetval;
}
- void ControlPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void ControlPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const
{
// try to create a bitmap decomposition. If that fails for some reason,
// at least create a replacement decomposition.
- Primitive2DReference xReference(createBitmapDecomposition(rViewInformation));
+ Primitive2DReference xReference(createBitmapDecomposition(rParameters));
if(!xReference.is())
{
@@ -310,7 +312,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange ControlPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange ControlPrimitive2D::getB2DRange(VisitorParameters const & /*rParameters*/) const
{
// simply derivate from unit range
basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
@@ -318,12 +320,12 @@ namespace drawinglayer::primitive2d
return aRetval;
}
- void ControlPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void ControlPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
// this primitive is view-dependent related to the scaling. If scaling has changed,
// destroy existing decomposition. To detect change, use size of unit size in view coordinates
::osl::MutexGuard aGuard( m_aMutex );
- const basegfx::B2DVector aNewScaling(rViewInformation.getObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0));
+ const basegfx::B2DVector aNewScaling(rParameters.getViewInformation().getObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0));
if(!getBuffered2DDecomposition().empty())
{
@@ -341,7 +343,7 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
// provide unique ID
diff --git a/drawinglayer/source/primitive2d/cropprimitive2d.cxx b/drawinglayer/source/primitive2d/cropprimitive2d.cxx
index ff460a59fd11..f618962d2dc3 100644
--- a/drawinglayer/source/primitive2d/cropprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/cropprimitive2d.cxx
@@ -63,7 +63,7 @@ namespace drawinglayer::primitive2d
return false;
}
- void CropPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void CropPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & /*rParameters*/) const
{
if(getChildren().empty())
return;
diff --git a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
index 9389fd3aec00..7df3a6267858 100644
--- a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
@@ -25,7 +25,7 @@
namespace drawinglayer::primitive2d
{
- void DiscreteBitmapPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void DiscreteBitmapPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & /*rParameters*/) const
{
// use getViewTransformation() and getObjectTransformation() from
// ObjectAndViewTransformationDependentPrimitive2D to create a BitmapPrimitive2D
diff --git a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx
index 36b97c99d8f2..273a16432f6f 100644
--- a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx
@@ -157,7 +157,7 @@ namespace drawinglayer::primitive2d
namespace drawinglayer::primitive2d
{
- void DiscreteShadowPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void DiscreteShadowPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & /*rParameters*/) const
{
Primitive2DContainer xRetval;
@@ -284,7 +284,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange DiscreteShadowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ basegfx::B2DRange DiscreteShadowPrimitive2D::getB2DRange(VisitorParameters const & rParameters) const
{
if(getDiscreteShadow().getBitmapEx().IsEmpty())
{
@@ -298,7 +298,7 @@ namespace drawinglayer::primitive2d
aRetval.transform(getTransform());
// extract discrete shadow size and grow
- const basegfx::B2DVector aScale(rViewInformation.getViewTransformation() * basegfx::B2DVector(1.0, 1.0));
+ const basegfx::B2DVector aScale(rParameters.getViewInformation().getViewTransformation() * basegfx::B2DVector(1.0, 1.0));
const sal_Int32 nQuarter((getDiscreteShadow().getBitmapEx().GetSizePixel().Width() - 3) >> 2);
const double fGrowX((1.0 / aScale.getX()) * nQuarter);
const double fGrowY((1.0 / aScale.getY()) * nQuarter);
diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx
index e681e31c2084..713c7c11f6ca 100644
--- a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx
@@ -60,10 +60,10 @@ namespace drawinglayer::primitive2d
return !maShadowPrimitives.empty();
}
- void Embedded3DPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void Embedded3DPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const
{
// use info to create a yellow 2d rectangle, similar to empty 3d scenes and/or groups
- const basegfx::B2DRange aLocal2DRange(getB2DRange(rViewInformation));
+ const basegfx::B2DRange aLocal2DRange(getB2DRange(rParameters));
const basegfx::B2DPolygon aOutline(basegfx::utils::createPolygonFromRect(aLocal2DRange));
const basegfx::BColor aYellow(1.0, 1.0, 0.0);
rContainer.push_back(new PolygonHairlinePrimitive2D(aOutline, aYellow));
@@ -107,7 +107,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange Embedded3DPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ basegfx::B2DRange Embedded3DPrimitive2D::getB2DRange(VisitorParameters const & rParameters) const
{
if(maB2DRange.isEmpty())
{
@@ -125,7 +125,7 @@ namespace drawinglayer::primitive2d
// taken into account
if(impGetShadow3D())
{
- const basegfx::B2DRange aShadow2DRange(maShadowPrimitives.getB2DRange(rViewInformation));
+ const basegfx::B2DRange aShadow2DRange(maShadowPrimitives.getB2DRange(rParameters));
if(!aShadow2DRange.isEmpty())
{
diff --git a/drawinglayer/source/primitive2d/epsprimitive2d.cxx b/drawinglayer/source/primitive2d/epsprimitive2d.cxx
index ea22e529e22e..670edab79bd4 100644
--- a/drawinglayer/source/primitive2d/epsprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/epsprimitive2d.cxx
@@ -23,7 +23,7 @@
namespace drawinglayer::primitive2d
{
- void EpsPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void EpsPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & /*rParameters*/) const
{
const GDIMetaFile& rSubstituteContent = getMetaFile();
@@ -65,7 +65,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange EpsPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange EpsPrimitive2D::getB2DRange(VisitorParameters const & /*rParameters*/) const
{
// use own implementation to quickly answer the getB2DRange question.
basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
index 10fff2638865..a41c4f6878ca 100644
--- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
@@ -269,7 +269,7 @@ namespace drawinglayer::primitive2d
}
}
- void FillGradientPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void FillGradientPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & /*rParameters*/) const
{
// default creates overlapping fill which works with AntiAliasing and without.
// The non-overlapping version does not create single filled polygons, but
@@ -319,7 +319,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange FillGradientPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange FillGradientPrimitive2D::getB2DRange(VisitorParameters const & /*rParameters*/) const
{
// return the geometrically visible area
return getOutputRange();
diff --git a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
index c8f1aa6f92d2..32089df1ecce 100644
--- a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
@@ -33,7 +33,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void FillGraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void FillGraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & /*rParameters*/) const
{
const attribute::FillGraphicAttribute& rAttribute = getFillGraphic();
@@ -112,7 +112,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange FillGraphicPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange FillGraphicPrimitive2D::getB2DRange(VisitorParameters const & /*rParameters*/) const
{
// return range of it
basegfx::B2DPolygon aPolygon(basegfx::utils::createUnitPolygon());
diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
index ec81e9ec0d41..2c36b1f94fe1 100644
--- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
@@ -32,7 +32,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void FillHatchPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void FillHatchPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & /*rParameters*/) const
{
if(getFillHatch().isDefault())
return;
@@ -167,13 +167,13 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange FillHatchPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange FillHatchPrimitive2D::getB2DRange(VisitorParameters const & /*rParameters*/) const
{
// return the geometrically visible area
return getOutputRange();
}
- void FillHatchPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void FillHatchPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
::osl::MutexGuard aGuard( m_aMutex );
bool bAdaptDistance(0 != getFillHatch().getMinimalDiscreteDistance());
@@ -181,12 +181,12 @@ namespace drawinglayer::primitive2d
if(bAdaptDistance)
{
// behave view-dependent
- DiscreteMetricDependentPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ DiscreteMetricDependentPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
else
{
// behave view-independent
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
}
diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
index e6adcb4b66d8..45007c7300bc 100644
--- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
@@ -45,10 +45,9 @@ bool GlowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
return false;
}
-basegfx::B2DRange
-GlowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+basegfx::B2DRange GlowPrimitive2D::getB2DRange(VisitorParameters const& rParameters) const
{
- basegfx::B2DRange aRetval(GroupPrimitive2D::getB2DRange(rViewInformation));
+ basegfx::B2DRange aRetval(GroupPrimitive2D::getB2DRange(rParameters));
// We need additional space for the glow from all sides
aRetval.grow(getGlowRadius());
return aRetval;
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
index 0319c50a7f8e..42157b6598f4 100644
--- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
@@ -31,7 +31,7 @@
namespace drawinglayer::primitive2d
{
void GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer,
- const geometry::ViewInformation2D&) const
+ VisitorParameters const& /*rParameters*/) const
{
if (0 == getGraphicAttr().GetAlpha())
{
@@ -202,8 +202,7 @@ bool GraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
return false;
}
-basegfx::B2DRange
-GraphicPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+basegfx::B2DRange GraphicPrimitive2D::getB2DRange(VisitorParameters const& /*rParameters*/) const
{
basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
aRetval.transform(getTransform());
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index e8174733bf34..49443e7a001e 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -351,7 +351,7 @@ namespace drawinglayer::primitive2d
virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
/// override to deliver the correct expected frame dependent of timing
- virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & /*rParameters*/) const override;
};
}
@@ -422,13 +422,13 @@ namespace drawinglayer::primitive2d
&& maGraphic == pCompare->maGraphic);
}
- void AnimatedGraphicPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void AnimatedGraphicPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
if (!isValidData())
return;
Primitive2DReference aRetval;
- const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime()));
+ const double fState(getAnimationEntry().getStateAtTime(rParameters.getViewInformation().getViewTime()));
const sal_uInt32 nLen(maAnimation.Count());
sal_uInt32 nIndex(basegfx::fround(fState * static_cast<double>(nLen)));
diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx b/drawinglayer/source/primitive2d/gridprimitive2d.cxx
index 4c560109ec1e..559257487928 100644
--- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx
@@ -30,8 +30,10 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void GridPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void GridPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const
{
+ auto const & rViewInformation = rParameters.getViewInformation();
+
if(!(!rViewInformation.getViewport().isEmpty() && getWidth() > 0.0 && getHeight() > 0.0))
return;
@@ -294,25 +296,27 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange GridPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ basegfx::B2DRange GridPrimitive2D::getB2DRange(VisitorParameters const & rParameters) const
{
// get object's range
basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0);
aUnitRange.transform(getTransform());
// intersect with visible part
- aUnitRange.intersect(rViewInformation.getViewport());
+ aUnitRange.intersect(rParameters.getViewInformation().getViewport());
return aUnitRange;
}
- void GridPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void GridPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
::osl::MutexGuard aGuard( m_aMutex );
+ auto const & rViewInformation = rParameters.getViewInformation();
if(!getBuffered2DDecomposition().empty())
{
- if(maLastViewport != rViewInformation.getViewport() || maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation())
+ if( maLastViewport != rViewInformation.getViewport() ||
+ maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation())
{
// conditions of last local decomposition have changed, delete
const_cast< GridPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer());
@@ -327,7 +331,7 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
// provide unique ID
diff --git a/drawinglayer/source/primitive2d/groupprimitive2d.cxx b/drawinglayer/source/primitive2d/groupprimitive2d.cxx
index 28f4f064608e..f911843c875c 100644
--- a/drawinglayer/source/primitive2d/groupprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/groupprimitive2d.cxx
@@ -49,7 +49,7 @@ namespace drawinglayer::primitive2d
}
/// default: just return children, so all renderers not supporting group will use its content
- void GroupPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void GroupPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & /*rParameters*/) const
{
getChildren(rVisitor);
}
diff --git a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx
index d43440fead63..9497e0c3ae63 100644
--- a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx
@@ -30,8 +30,10 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void HelplinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void HelplinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const
{
+ auto const & rViewInformation = rParameters.getViewInformation();
+
if(rViewInformation.getViewport().isEmpty() || getDirection().equalZero())
return;
@@ -156,9 +158,10 @@ namespace drawinglayer::primitive2d
return false;
}
- void HelplinePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void HelplinePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
::osl::MutexGuard aGuard( m_aMutex );
+ auto const & rViewInformation = rParameters.getViewInformation();
if(!getBuffered2DDecomposition().empty())
{
@@ -177,7 +180,7 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
// provide unique ID
diff --git a/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx b/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx
index c1298cd9589b..163d8f7706f5 100644
--- a/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx
@@ -32,12 +32,13 @@ namespace drawinglayer::primitive2d
{
}
- basegfx::B2DRange HiddenGeometryPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ basegfx::B2DRange HiddenGeometryPrimitive2D::getB2DRange(VisitorParameters const & rParameters) const
{
- return getChildren().getB2DRange(rViewInformation);
+ return getChildren().getB2DRange(rParameters);
}
- void HiddenGeometryPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& /*rVisitor*/, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void HiddenGeometryPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& /*rVisitor*/,
+ VisitorParameters const & /*rParameters*/) const
{
}
diff --git a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx
index 46d27c3eaa74..85308b3d0396 100644
--- a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx
@@ -30,7 +30,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void MarkerArrayPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void MarkerArrayPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const
{
const std::vector< basegfx::B2DPoint >& rPositions = getPositions();
const sal_uInt32 nMarkerCount(rPositions.size());
@@ -45,7 +45,7 @@ namespace drawinglayer::primitive2d
return;
// get logic half pixel size
- basegfx::B2DVector aLogicHalfSize(rViewInformation.getInverseObjectToViewTransformation() *
+ basegfx::B2DVector aLogicHalfSize(rParameters.getViewInformation().getInverseObjectToViewTransformation() *
basegfx::B2DVector(aBitmapSize.getWidth() - 1.0, aBitmapSize.getHeight() - 1.0));
// use half size for expand
@@ -91,7 +91,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange MarkerArrayPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ basegfx::B2DRange MarkerArrayPrimitive2D::getB2DRange(VisitorParameters const & rParameters) const
{
basegfx::B2DRange aRetval;
@@ -111,7 +111,7 @@ namespace drawinglayer::primitive2d
if(aBitmapSize.Width() && aBitmapSize.Height())
{
// get logic half size
- basegfx::B2DVector aLogicHalfSize(rViewInformation.getInverseObjectToViewTransformation() *
+ basegfx::B2DVector aLogicHalfSize(rParameters.getViewInformation().getInverseObjectToViewTransformation() *
basegfx::B2DVector(aBitmapSize.getWidth(), aBitmapSize.getHeight()));
// use half size for expand
diff --git a/drawinglayer/source/primitive2d/maskprimitive2d.cxx b/drawinglayer/source/primitive2d/maskprimitive2d.cxx
index 8a71d97008b9..f0040682ae34 100644
--- a/drawinglayer/source/primitive2d/maskprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/maskprimitive2d.cxx
@@ -46,7 +46,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange MaskPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange MaskPrimitive2D::getB2DRange(VisitorParameters const & /*rParameters*/) const
{
return getMask().getB2DRange();
}
diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
index 349e8b1a113c..172b052e8937 100644
--- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
@@ -31,7 +31,7 @@
namespace drawinglayer::primitive2d
{
- void MediaPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void MediaPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const
{
Primitive2DContainer xRetval;
xRetval.resize(1);
@@ -55,7 +55,7 @@ namespace drawinglayer::primitive2d
if(getDiscreteBorder())
{
- const basegfx::B2DVector aDiscreteInLogic(rViewInformation.getInverseObjectToViewTransformation() *
+ const basegfx::B2DVector aDiscreteInLogic(rParameters.getViewInformation().getInverseObjectToViewTransformation() *
basegfx::B2DVector(static_cast<double>(getDiscreteBorder()), static_cast<double>(getDiscreteBorder())));
const double fDiscreteSize(aDiscreteInLogic.getX() + aDiscreteInLogic.getY());
@@ -120,14 +120,14 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange MediaPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ basegfx::B2DRange MediaPrimitive2D::getB2DRange(VisitorParameters const & rParameters) const
{
basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
aRetval.transform(getTransform());
if(getDiscreteBorder())
{
- const basegfx::B2DVector aDiscreteInLogic(rViewInformation.getInverseObjectToViewTransformation() *
+ const basegfx::B2DVector aDiscreteInLogic(rParameters.getViewInformation().getInverseObjectToViewTransformation() *
basegfx::B2DVector(static_cast<double>(getDiscreteBorder()), static_cast<double>(getDiscreteBorder())));
const double fDiscreteSize(aDiscreteInLogic.getX() + aDiscreteInLogic.getY());
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index 22ef460ec205..766f784da1f7 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -30,11 +30,11 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void MetafilePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void MetafilePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const
{
// Interpret the Metafile and get the content. There should be only one target, as in the start condition,
// but iterating will be the right thing to do when some push/pop is not closed
- Primitive2DContainer xRetval(wmfemfhelper::interpretMetafile(getMetaFile(), rViewInformation));
+ Primitive2DContainer xRetval(wmfemfhelper::interpretMetafile(getMetaFile(), rParameters.getViewInformation()));
if(!xRetval.empty())
{
@@ -46,7 +46,7 @@ namespace drawinglayer::primitive2d
// defined target range (aMtfRange)
if (!aMtfRange.isEmpty())
{
- const basegfx::B2DRange aContentRange(xRetval.getB2DRange(rViewInformation));
+ const basegfx::B2DRange aContentRange(xRetval.getB2DRange(rParameters));
// also test equal since isInside gives also true for equal
if (!aMtfRange.equal(aContentRange) && !aMtfRange.isInside(aContentRange))
@@ -107,7 +107,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange MetafilePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange MetafilePrimitive2D::getB2DRange(VisitorParameters const & /*rParameters*/) const
{
// use own implementation to quickly answer the getB2DRange question. The
// MetafilePrimitive2D assumes that all geometry is inside of the shape. If
diff --git a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx
index 456b02333858..b2820cd6afbc 100644
--- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx
@@ -31,7 +31,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void PagePreviewPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void PagePreviewPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const
{
Primitive2DContainer aContent(getPageContent());
@@ -50,7 +50,7 @@ namespace drawinglayer::primitive2d
// check if content overlaps with target size and needs to be embedded with a
// clipping primitive
- const basegfx::B2DRange aRealContentRange(aContent.getB2DRange(rViewInformation));
+ const basegfx::B2DRange aRealContentRange(aContent.getB2DRange(rParameters));
const basegfx::B2DRange aAllowedContentRange(0.0, 0.0, getContentWidth(), getContentHeight());
if(!aAllowedContentRange.isInside(aRealContentRange))
@@ -131,7 +131,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange PagePreviewPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation`*/) const
+ basegfx::B2DRange PagePreviewPrimitive2D::getB2DRange(VisitorParameters const & /*rParameters*/) const
{
// nothing is allowed to stick out of a PagePreviewPrimitive, thus we
// can quickly deliver our range here
diff --git a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
index e7a1f7480b6c..84ebeffcddf1 100644
--- a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
@@ -93,24 +93,26 @@ namespace drawinglayer::primitive2d
}
}
- Primitive2DContainer PatternFillPrimitive2D::createContent(const geometry::ViewInformation2D& rViewInformation) const
+ Primitive2DContainer PatternFillPrimitive2D::createContent(VisitorParameters const & rParameters) const
{
Primitive2DContainer aContent;
// see if buffering is wanted. If so, create buffered content in given resolution
if(0 != mnDiscreteWidth && 0 != mnDiscreteHeight)
{
- const geometry::ViewInformation2D aViewInformation2D;
const primitive2d::Primitive2DReference xEmbedRef(
new primitive2d::TransformPrimitive2D(
basegfx::utils::createScaleB2DHomMatrix(mnDiscreteWidth, mnDiscreteHeight),
getChildren()));
const primitive2d::Primitive2DContainer xEmbedSeq { xEmbedRef };
+ const geometry::ViewInformation2D aViewInformation2D;
+ primitive2d::VisitorParameters aVisitorParameters(aViewInformation2D);
+
const BitmapEx aBitmapEx(
convertToBitmapEx(
xEmbedSeq,
- aViewInformation2D,
+ aVisitorParameters,
mnDiscreteWidth,
mnDiscreteHeight,
mnDiscreteWidth * mnDiscreteHeight));
@@ -142,7 +144,7 @@ namespace drawinglayer::primitive2d
// check if content needs to be clipped
const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0);
- const basegfx::B2DRange aContentRange(getChildren().getB2DRange(rViewInformation));
+ const basegfx::B2DRange aContentRange(getChildren().getB2DRange(rParameters));
if(!aUnitRange.isInside(aContentRange))
{
@@ -158,7 +160,7 @@ namespace drawinglayer::primitive2d
return aContent;
}
- void PatternFillPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void PatternFillPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitorParameters const & rParameters) const
{
Primitive2DContainer aRetval;
@@ -180,7 +182,7 @@ namespace drawinglayer::primitive2d
aTiling.appendTransformations(aMatrices);
// create content
- const Primitive2DContainer aContent(createContent(rViewInformation));
+ const Primitive2DContainer aContent(createContent(rParameters));
// resize result
aRetval.resize(aMatrices.size());
@@ -244,12 +246,12 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange PatternFillPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /* rViewInformation */ ) const
+ basegfx::B2DRange PatternFillPrimitive2D::getB2DRange(VisitorParameters const & /*rParameters*/) const
{
return getMask().getB2DRange();
}
- void PatternFillPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void PatternFillPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
// The existing buffered decomposition uses a buffer in the remembered
// size or none if sizes are zero. Get new needed sizes which depend on
@@ -257,7 +259,7 @@ namespace drawinglayer::primitive2d
bool bResetBuffering = false;
sal_uInt32 nW(0);
sal_uInt32 nH(0);
- calculateNeededDiscreteBufferSize(nW, nH, rViewInformation);
+ calculateNeededDiscreteBufferSize(nW, nH, rParameters.getViewInformation());
const bool bBufferingCurrentlyUsed(0 != mnDiscreteWidth && 0 != mnDiscreteHeight);
const bool bBufferingNextUsed(0 != nW && 0 != nH);
@@ -305,7 +307,7 @@ namespace drawinglayer::primitive2d
}
// call parent
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
sal_Int64 SAL_CALL PatternFillPrimitive2D::estimateUsage()
diff --git a/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx
index d616b26226fd..78d6337d0016 100644
--- a/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx
@@ -49,7 +49,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange PointArrayPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange PointArrayPrimitive2D::getB2DRange(VisitorParameters const & /*rParameters*/) const
{
if(maB2DRange.isEmpty())
{
diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
index 17e63883c94b..654cd8926f12 100644
--- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
@@ -53,7 +53,7 @@ bool PolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) c
}
basegfx::B2DRange
-PolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+PolygonHairlinePrimitive2D::getB2DRange(VisitorParameters const& rParameters) const
{
// this is a hairline, thus the line width is view-dependent. Get range of polygon
// as base size
@@ -63,7 +63,8 @@ PolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rView
{
// Calculate view-dependent hairline width
const basegfx::B2DVector aDiscreteSize(
- rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0));
+ rParameters.getViewInformation().getInverseObjectToViewTransformation()
+ * basegfx::B2DVector(1.0, 0.0));
const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5);
if (basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0))
@@ -82,12 +83,13 @@ sal_uInt32 PolygonHairlinePrimitive2D::getPrimitive2DID() const
return PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D;
}
-void PolygonMarkerPrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+void PolygonMarkerPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer,
+ VisitorParameters const& rParameters) const
{
// calculate logic DashLength
- const basegfx::B2DVector aDashVector(rViewInformation.getInverseObjectToViewTransformation()
- * basegfx::B2DVector(getDiscreteDashLength(), 0.0));
+ const basegfx::B2DVector aDashVector(
+ rParameters.getViewInformation().getInverseObjectToViewTransformation()
+ * basegfx::B2DVector(getDiscreteDashLength(), 0.0));
const double fLogicDashLength(aDashVector.getX());
if (fLogicDashLength > 0.0 && !getRGBColorA().equal(getRGBColorB()))
@@ -140,8 +142,7 @@ bool PolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) con
return false;
}
-basegfx::B2DRange
-PolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+basegfx::B2DRange PolygonMarkerPrimitive2D::getB2DRange(VisitorParameters const& rParameters) const
{
// this is a hairline, thus the line width is view-dependent. Get range of polygon
// as base size
@@ -151,7 +152,8 @@ PolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewIn
{
// Calculate view-dependent hairline width
const basegfx::B2DVector aDiscreteSize(
- rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0));
+ rParameters.getViewInformation().getInverseObjectToViewTransformation()
+ * basegfx::B2DVector(1.0, 0.0));
const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5);
if (basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0))
@@ -164,12 +166,12 @@ PolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewIn
return aRetval;
}
-void PolygonMarkerPrimitive2D::get2DDecomposition(
- Primitive2DDecompositionVisitor& rVisitor,
- const geometry::ViewInformation2D& rViewInformation) const
+void PolygonMarkerPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ VisitorParameters const& rParameters) const
{
::osl::MutexGuard aGuard(m_aMutex);
bool bNeedNewDecomposition(false);
+ auto const& rViewInformation = rParameters.getViewInformation();
if (!getBuffered2DDecomposition().empty())
{
@@ -196,7 +198,7 @@ void PolygonMarkerPrimitive2D::get2DDecomposition(
}
// use parent implementation
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
// provide unique ID
@@ -210,7 +212,7 @@ sal_uInt32 PolygonMarkerPrimitive2D::getPrimitive2DID() const
namespace drawinglayer::primitive2d
{
void PolygonStrokePrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitorParameters const& /*rParameters*/) const
{
if (!getB2DPolygon().count())
return;
@@ -312,9 +314,10 @@ bool PolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) con
return false;
}
-basegfx::B2DRange
-PolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+basegfx::B2DRange PolygonStrokePrimitive2D::getB2DRange(VisitorParameters const& rParameters) const
{
+ auto const& rViewInformation = rParameters.getViewInformation();
+
basegfx::B2DRange aRetval;
if (getLineAttribute().getWidth())
@@ -347,7 +350,7 @@ PolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewIn
attribute::StrokeAttribute aOrigStrokeAttribute = maStrokeAttribute;
const_cast<PolygonStrokePrimitive2D*>(this)->maStrokeAttribute
= attribute::StrokeAttribute();
- aRetval = BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation);
+ aRetval = BufferedDecompositionPrimitive2D::getB2DRange(rParameters);
const_cast<PolygonStrokePrimitive2D*>(this)->maStrokeAttribute = aOrigStrokeAttribute;
}
else
@@ -388,8 +391,8 @@ sal_uInt32 PolygonStrokePrimitive2D::getPrimitive2DID() const
return PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D;
}
-void PolygonWavePrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+void PolygonWavePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer,
+ VisitorParameters const& /*rParameters*/) const
{
if (!getB2DPolygon().count())
return;
@@ -464,11 +467,10 @@ bool PolygonWavePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
return false;
}
-basegfx::B2DRange
-PolygonWavePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+basegfx::B2DRange PolygonWavePrimitive2D::getB2DRange(VisitorParameters const& rParameters) const
{
// get range of parent
- basegfx::B2DRange aRetval(PolygonStrokePrimitive2D::getB2DRange(rViewInformation));
+ basegfx::B2DRange aRetval(PolygonStrokePrimitive2D::getB2DRange(rParameters));
// if WaveHeight, grow by it
if (basegfx::fTools::more(getWaveHeight(), 0.0))
@@ -492,7 +494,7 @@ sal_uInt32 PolygonWavePrimitive2D::getPrimitive2DID() const
}
void PolygonStrokeArrowPrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitorParameters const& /*rParameters*/) const
{
// copy local polygon, it may be changed
basegfx::B2DPolygon aLocalPolygon(getB2DPolygon());
@@ -590,18 +592,18 @@ bool PolygonStrokeArrowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive
return false;
}
-basegfx::B2DRange PolygonStrokeArrowPrimitive2D::getB2DRange(
- const geometry::ViewInformation2D& rViewInformation) const
+basegfx::B2DRange
+PolygonStrokeArrowPrimitive2D::getB2DRange(VisitorParameters const& rParameters) const
{
if (getStart().isActive() || getEnd().isActive())
{
// use decomposition when line start/end is used
- return BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation);
+ return BufferedDecompositionPrimitive2D::getB2DRange(rParameters);
}
else
{
// get range from parent
- return PolygonStrokePrimitive2D::getB2DRange(rViewInformation);
+ return PolygonStrokePrimitive2D::getB2DRange(rParameters);
}
}
diff --git a/drawinglayer/source/primitive2d/primitivetools2d.cxx b/drawinglayer/source/primitive2d/primitivetools2d.cxx
index da0a378a0089..c3a485d086c1 100644
--- a/drawinglayer/source/primitive2d/primitivetools2d.cxx
+++ b/drawinglayer/source/primitive2d/primitivetools2d.cxx
@@ -24,12 +24,12 @@
namespace drawinglayer::primitive2d
{
- void DiscreteMetricDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void DiscreteMetricDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
::osl::MutexGuard aGuard( m_aMutex );
// get the current DiscreteUnit, look at X and Y and use the maximum
- const basegfx::B2DVector aDiscreteVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0));
+ const basegfx::B2DVector aDiscreteVector(rParameters.getViewInformation().getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0));
const double fDiscreteUnit(std::min(fabs(aDiscreteVector.getX()), fabs(aDiscreteVector.getY())));
if(!getBuffered2DDecomposition().empty() && !basegfx::fTools::equal(fDiscreteUnit, getDiscreteUnit()))
@@ -45,18 +45,18 @@ namespace drawinglayer::primitive2d
}
// call base implementation
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
- void ViewportDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void ViewportDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
::osl::MutexGuard aGuard( m_aMutex );
// get the current Viewport
- const basegfx::B2DRange& rViewport = rViewInformation.getViewport();
+ const basegfx::B2DRange& rViewport = rParameters.getViewInformation().getViewport();
if(!getBuffered2DDecomposition().empty() && !rViewport.equal(getViewport()))
{
@@ -71,15 +71,15 @@ namespace drawinglayer::primitive2d
}
// call base implementation
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
- void ViewTransformationDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void ViewTransformationDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitorParameters const & rParameters) const
{
::osl::MutexGuard aGuard( m_aMutex );
// get the current ViewTransformation
- const basegfx::B2DHomMatrix& rViewTransformation = rViewInformation.getViewTransformation();
+ const basegfx::B2DHomMatrix& rViewTransformation = rParameters.getViewInformation().getViewTransformation();
if(!getBuffered2DDecomposition().empty() && rViewTransformation != getViewTransformation())
{
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list