summaryrefslogtreecommitdiff
path: root/drawinglayer/source
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source')
-rw-r--r--drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx2
-rw-r--r--drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx2
-rw-r--r--drawinglayer/source/primitive2d/Primitive2DContainer.cxx69
-rw-r--r--drawinglayer/source/primitive2d/Tools.cxx28
-rw-r--r--drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx3
-rw-r--r--drawinglayer/source/primitive2d/baseprimitive2d.cxx9
-rw-r--r--drawinglayer/source/primitive2d/bitmapprimitive2d.cxx2
-rw-r--r--drawinglayer/source/primitive2d/controlprimitive2d.cxx2
-rw-r--r--drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx2
-rw-r--r--drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx2
-rw-r--r--drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx2
-rw-r--r--drawinglayer/source/primitive2d/gridprimitive2d.cxx3
-rw-r--r--drawinglayer/source/primitive2d/groupprimitive2d.cxx9
-rw-r--r--drawinglayer/source/primitive2d/helplineprimitive2d.cxx3
-rw-r--r--drawinglayer/source/primitive2d/patternfillprimitive2d.cxx11
-rw-r--r--drawinglayer/source/primitive2d/polygonprimitive2d.cxx2
-rw-r--r--drawinglayer/source/primitive2d/primitivetools2d.cxx12
-rw-r--r--drawinglayer/source/primitive2d/sceneprimitive2d.cxx5
-rw-r--r--drawinglayer/source/primitive2d/texteffectprimitive2d.cxx3
-rw-r--r--drawinglayer/source/processor2d/baseprocessor2d.cxx9
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx4
-rw-r--r--drawinglayer/source/processor3d/defaultprocessor3d.cxx1
-rw-r--r--drawinglayer/source/tools/converters.cxx97
-rw-r--r--drawinglayer/source/tools/primitive2dxmldump.cxx5
-rw-r--r--drawinglayer/source/tools/wmfemfhelper.cxx2
25 files changed, 209 insertions, 80 deletions
diff --git a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
index abca8a310925..4c236606711e 100644
--- a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
+++ b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
@@ -133,7 +133,7 @@ namespace drawinglayer::unorenderer
const primitive2d::Primitive2DReference xEmbedRef(
new primitive2d::TransformPrimitive2D(
aEmbedding,
- comphelper::sequenceToContainer<primitive2d::Primitive2DContainer>(aPrimitive2DSequence)));
+ aPrimitive2DSequence));
primitive2d::Primitive2DContainer xEmbedSeq { xEmbedRef };
BitmapEx aBitmapEx(
diff --git a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
index 769b23fb5b80..68ccc714c688 100644
--- a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
@@ -33,8 +33,6 @@ void BufferedDecompositionPrimitive2D::get2DDecomposition(
Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation) const
{
- std::unique_lock aGuard(m_aMutex);
-
if (getBuffered2DDecomposition().empty())
{
Primitive2DContainer aNewSequence;
diff --git a/drawinglayer/source/primitive2d/Primitive2DContainer.cxx b/drawinglayer/source/primitive2d/Primitive2DContainer.cxx
index 3ae4a9b3e3c4..b6c30a1c43bf 100644
--- a/drawinglayer/source/primitive2d/Primitive2DContainer.cxx
+++ b/drawinglayer/source/primitive2d/Primitive2DContainer.cxx
@@ -21,12 +21,39 @@
#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/primitive2d/Tools.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
using namespace css;
namespace drawinglayer::primitive2d
{
+Primitive2DContainer::Primitive2DContainer(
+ const css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>>& rSource)
+{
+ for (const auto& rPrimitive : rSource)
+ append(static_cast<const UnoPrimitive2D*>(rPrimitive.get())->getBasePrimitive2D());
+}
+Primitive2DContainer::Primitive2DContainer(
+ const std::deque<css::uno::Reference<css::graphic::XPrimitive2D>>& rSource)
+{
+ for (const auto& rPrimitive : rSource)
+ append(static_cast<const UnoPrimitive2D*>(rPrimitive.get())->getBasePrimitive2D());
+}
+
+css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>>
+Primitive2DContainer::toSequence() const
+{
+ css::uno::Sequence<css::uno::Reference<css::graphic::XPrimitive2D>> aVal(size());
+ auto p = aVal.getArray();
+ for (const auto& rPrimitive : *this)
+ {
+ *p = new UnoPrimitive2D(rPrimitive);
+ ++p;
+ }
+ return aVal;
+}
+
Primitive2DContainer Primitive2DContainer::maybeInvert(bool bInvert) const
{
const sal_uInt32 nSize(size());
@@ -115,7 +142,47 @@ void Primitive2DContainer::append(Primitive2DContainer&& rSource)
void Primitive2DContainer::append(const Primitive2DSequence& rSource)
{
- this->insert(this->end(), rSource.begin(), rSource.end());
+ for (const auto& rPrimitive : rSource)
+ append(static_cast<const UnoPrimitive2D*>(rPrimitive.get())->getBasePrimitive2D());
+}
+
+UnoPrimitive2D::~UnoPrimitive2D() {}
+
+basegfx::B2DRange
+UnoPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+{
+ std::unique_lock aGuard(m_aMutex);
+ return mxPrimitive->getB2DRange(rViewInformation);
+}
+
+sal_uInt32 UnoPrimitive2D::getPrimitive2DID() const { return mxPrimitive->getPrimitive2DID(); }
+
+void UnoPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ const geometry::ViewInformation2D& rViewInformation) const
+{
+ std::unique_lock aGuard(m_aMutex);
+ mxPrimitive->get2DDecomposition(rVisitor, rViewInformation);
+}
+
+css::uno::Sequence<::css::uno::Reference<::css::graphic::XPrimitive2D>>
+ SAL_CALL UnoPrimitive2D::getDecomposition(
+ const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters)
+{
+ std::unique_lock aGuard(m_aMutex);
+ return mxPrimitive->getDecomposition(rViewParameters).toSequence();
+}
+
+css::geometry::RealRectangle2D SAL_CALL
+UnoPrimitive2D::getRange(const css::uno::Sequence<css::beans::PropertyValue>& rViewParameters)
+{
+ std::unique_lock aGuard(m_aMutex);
+ return mxPrimitive->getRange(rViewParameters);
+}
+
+sal_Int64 SAL_CALL UnoPrimitive2D::estimateUsage()
+{
+ std::unique_lock aGuard(m_aMutex);
+ return mxPrimitive->estimateUsage();
}
} // end of namespace drawinglayer::primitive2d
diff --git a/drawinglayer/source/primitive2d/Tools.cxx b/drawinglayer/source/primitive2d/Tools.cxx
index 7be666a2cbd0..87272d9d1f9d 100644
--- a/drawinglayer/source/primitive2d/Tools.cxx
+++ b/drawinglayer/source/primitive2d/Tools.cxx
@@ -35,9 +35,7 @@ getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate,
if (!rCandidate)
return basegfx::B2DRange();
- // get C++ implementation base
- const BasePrimitive2D* pCandidate(static_cast<BasePrimitive2D*>(rCandidate.get()));
- return pCandidate->getB2DRange(aViewInformation);
+ return rCandidate->getB2DRange(aViewInformation);
}
bool arePrimitive2DReferencesEqual(const Primitive2DReference& rxA, const Primitive2DReference& rxB)
@@ -54,10 +52,28 @@ bool arePrimitive2DReferencesEqual(const Primitive2DReference& rxA, const Primit
return true;
}
- const BasePrimitive2D* pA(static_cast<const BasePrimitive2D*>(rxA.get()));
- const BasePrimitive2D* pB(static_cast<const BasePrimitive2D*>(rxB.get()));
+ return rxA->operator==(*rxB);
+}
+
+bool arePrimitive2DReferencesEqual(const css::uno::Reference<css::graphic::XPrimitive2D>& rxA,
+ const css::uno::Reference<css::graphic::XPrimitive2D>& rxB)
+{
+ const bool bAIs(rxA.is());
+
+ if (bAIs != rxB.is())
+ {
+ return false;
+ }
+
+ if (!bAIs)
+ {
+ return true;
+ }
+
+ auto pA = static_cast<const UnoPrimitive2D*>(rxA.get());
+ auto pB = static_cast<const UnoPrimitive2D*>(rxB.get());
- return pA->operator==(*pB);
+ return (*pA->getBasePrimitive2D()) == (*pB->getBasePrimitive2D());
}
OUString idToString(sal_uInt32 nId)
diff --git a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
index 68f31cb4c67a..8f68d9e73ba3 100644
--- a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
@@ -67,8 +67,6 @@ namespace drawinglayer::primitive2d
void BackgroundColorPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
- std::unique_lock aGuard( m_aMutex );
-
if(!getBuffered2DDecomposition().empty() && (maLastViewport != rViewInformation.getViewport()))
{
// conditions of last local decomposition have changed, delete
@@ -82,7 +80,6 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
- aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index 86eaa37eb976..b5590bce082c 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -19,6 +19,7 @@
#include <sal/config.h>
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <drawinglayer/primitive2d/Tools.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
@@ -141,23 +142,23 @@ void BasePrimitive2D::get2DDecomposition(
{
}
-css::uno::Sequence<::css::uno::Reference<::css::graphic::XPrimitive2D>> SAL_CALL
+Primitive2DContainer
BasePrimitive2D::getDecomposition(const uno::Sequence<beans::PropertyValue>& rViewParameters)
{
const auto aViewInformation = geometry::createViewInformation2D(rViewParameters);
Primitive2DContainer aContainer;
get2DDecomposition(aContainer, aViewInformation);
- return comphelper::containerToSequence(aContainer);
+ return aContainer;
}
-css::geometry::RealRectangle2D SAL_CALL
+css::geometry::RealRectangle2D
BasePrimitive2D::getRange(const uno::Sequence<beans::PropertyValue>& rViewParameters)
{
const auto aViewInformation = geometry::createViewInformation2D(rViewParameters);
return basegfx::unotools::rectangle2DFromB2DRectangle(getB2DRange(aViewInformation));
}
-sal_Int64 SAL_CALL BasePrimitive2D::estimateUsage()
+sal_Int64 BasePrimitive2D::estimateUsage()
{
return 0; // for now ignore the objects themselves
}
diff --git a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
index 0a06010d31e2..6f256b6e1850 100644
--- a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
@@ -52,7 +52,7 @@ BitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInforma
return aRetval;
}
-sal_Int64 SAL_CALL BitmapPrimitive2D::estimateUsage()
+sal_Int64 BitmapPrimitive2D::estimateUsage()
{
if (!getXBitmap().is())
{
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index db27950df5d5..461400dafb84 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -316,7 +316,6 @@ namespace drawinglayer::primitive2d
{
// 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
- std::unique_lock aGuard( m_aMutex );
const basegfx::B2DVector aNewScaling(rViewInformation.getObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0));
if(!getBuffered2DDecomposition().empty())
@@ -335,7 +334,6 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
- aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx
index fe83b3850d8f..f072df0c33a7 100644
--- a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx
@@ -35,8 +35,6 @@ namespace drawinglayer::primitive2d
{
bool Embedded3DPrimitive2D::impGetShadow3D() const
{
- std::unique_lock aGuard( m_aMutex );
-
// create on demand
if(!mbShadow3DChecked && !getChildren3D().empty())
{
diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
index 07c48612d21d..09a82bdd89ca 100644
--- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
@@ -173,10 +173,8 @@ namespace drawinglayer::primitive2d
void FillHatchPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
- std::unique_lock aGuard( m_aMutex );
bool bAdaptDistance(0 != getFillHatch().getMinimalDiscreteDistance());
- aGuard.unlock();
if(bAdaptDistance)
{
// behave view-dependent
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index c8a4da035455..9974117b5ae0 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -518,7 +518,7 @@ namespace drawinglayer::primitive2d
aRetval.resize(1);
aRetval[0] = new TransformPrimitive2D(
aEmbedVectorGraphic,
- rGraphic.getVectorGraphicData()->getPrimitive2DSequence());
+ Primitive2DContainer(rGraphic.getVectorGraphicData()->getPrimitive2DSequence()));
}
}
else
diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx b/drawinglayer/source/primitive2d/gridprimitive2d.cxx
index 515263e0d475..ddb468e9ad39 100644
--- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx
@@ -305,8 +305,6 @@ namespace drawinglayer::primitive2d
void GridPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
- std::unique_lock aGuard( m_aMutex );
-
if(!getBuffered2DDecomposition().empty())
{
if(maLastViewport != rViewInformation.getViewport() || maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation())
@@ -324,7 +322,6 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
- aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
diff --git a/drawinglayer/source/primitive2d/groupprimitive2d.cxx b/drawinglayer/source/primitive2d/groupprimitive2d.cxx
index 8c16d848fdff..7a39bde2ccf4 100644
--- a/drawinglayer/source/primitive2d/groupprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/groupprimitive2d.cxx
@@ -53,16 +53,13 @@ namespace drawinglayer::primitive2d
getChildren(rVisitor);
}
- sal_Int64 SAL_CALL GroupPrimitive2D::estimateUsage()
+ sal_Int64 GroupPrimitive2D::estimateUsage()
{
size_t nRet(0);
for (auto& it : getChildren())
{
- uno::Reference<util::XAccounting> const xAcc(it, uno::UNO_QUERY);
- if (xAcc.is())
- {
- nRet += xAcc->estimateUsage();
- }
+ if (it)
+ nRet += it->estimateUsage();
}
return nRet;
}
diff --git a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx
index 612181bb7854..07d6a7f2236f 100644
--- a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx
@@ -155,8 +155,6 @@ namespace drawinglayer::primitive2d
void HelplinePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
- std::unique_lock aGuard( m_aMutex );
-
if(!getBuffered2DDecomposition().empty())
{
if(maLastViewport != rViewInformation.getViewport() || maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation())
@@ -174,7 +172,6 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
- aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
diff --git a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
index cd4c58d11127..b667545b5347 100644
--- a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
@@ -350,17 +350,12 @@ namespace drawinglayer::primitive2d
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
- sal_Int64 SAL_CALL PatternFillPrimitive2D::estimateUsage()
+ sal_Int64 PatternFillPrimitive2D::estimateUsage()
{
size_t nRet(0);
for (auto& it : getChildren())
- {
- uno::Reference<util::XAccounting> const xAcc(it, uno::UNO_QUERY);
- if (xAcc.is())
- {
- nRet += xAcc->estimateUsage();
- }
- }
+ if (it)
+ nRet += it->estimateUsage();
return nRet;
}
diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
index 0ed46fa68c81..1cbde11ae96b 100644
--- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
@@ -167,7 +167,6 @@ void PolygonMarkerPrimitive2D::get2DDecomposition(
Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation) const
{
- std::unique_lock aGuard(m_aMutex);
bool bNeedNewDecomposition(false);
if (!getBuffered2DDecomposition().empty())
@@ -195,7 +194,6 @@ void PolygonMarkerPrimitive2D::get2DDecomposition(
}
// use parent implementation
- aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
diff --git a/drawinglayer/source/primitive2d/primitivetools2d.cxx b/drawinglayer/source/primitive2d/primitivetools2d.cxx
index c4ab4f5c800b..7c6d426e95a2 100644
--- a/drawinglayer/source/primitive2d/primitivetools2d.cxx
+++ b/drawinglayer/source/primitive2d/primitivetools2d.cxx
@@ -26,8 +26,6 @@ namespace drawinglayer::primitive2d
{
void DiscreteMetricDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
- std::unique_lock 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 double fDiscreteUnit(std::min(fabs(aDiscreteVector.getX()), fabs(aDiscreteVector.getY())));
@@ -45,7 +43,6 @@ namespace drawinglayer::primitive2d
}
// call base implementation
- aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
@@ -54,8 +51,6 @@ namespace drawinglayer::primitive2d
void ViewportDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
- std::unique_lock aGuard( m_aMutex );
-
// get the current Viewport
const basegfx::B2DRange& rViewport = rViewInformation.getViewport();
@@ -72,14 +67,11 @@ namespace drawinglayer::primitive2d
}
// call base implementation
- aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
void ViewTransformationDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
- std::unique_lock aGuard( m_aMutex );
-
// get the current ViewTransformation
const basegfx::B2DHomMatrix& rViewTransformation = rViewInformation.getViewTransformation();
@@ -96,14 +88,11 @@ namespace drawinglayer::primitive2d
}
// call base implementation
- aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
void ObjectAndViewTransformationDependentPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
- std::unique_lock aGuard( m_aMutex );
-
// get the current ViewTransformation
const basegfx::B2DHomMatrix& rViewTransformation = rViewInformation.getViewTransformation();
@@ -130,7 +119,6 @@ namespace drawinglayer::primitive2d
}
// call base implementation
- aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
index 4f238cef4792..d371cdedcd5c 100644
--- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
@@ -509,8 +509,6 @@ namespace drawinglayer::primitive2d
Primitive2DContainer ScenePrimitive2D::getShadow2D() const
{
- std::unique_lock aGuard( m_aMutex );
-
Primitive2DContainer aRetval;
// create 2D shadows from contained 3D primitives
@@ -624,8 +622,6 @@ namespace drawinglayer::primitive2d
void ScenePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
- std::unique_lock aGuard( m_aMutex );
-
// get the involved ranges (see helper method calculateDiscreteSizes for details)
basegfx::B2DRange aDiscreteRange;
basegfx::B2DRange aUnitVisibleRange;
@@ -679,7 +675,6 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
- aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
diff --git a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx
index d05e727ce50c..dae397e1abd8 100644
--- a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx
@@ -213,8 +213,6 @@ void TextEffectPrimitive2D::get2DDecomposition(
Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation) const
{
- std::unique_lock aGuard(m_aMutex);
-
if (!getBuffered2DDecomposition().empty())
{
if (maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation())
@@ -233,7 +231,6 @@ void TextEffectPrimitive2D::get2DDecomposition(
}
// use parent implementation
- aGuard.unlock();
BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
}
diff --git a/drawinglayer/source/processor2d/baseprocessor2d.cxx b/drawinglayer/source/processor2d/baseprocessor2d.cxx
index b4291dd4431c..e7a6a44932f7 100644
--- a/drawinglayer/source/processor2d/baseprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/baseprocessor2d.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <comphelper/sequence.hxx>
@@ -48,8 +49,7 @@ namespace drawinglayer::processor2d
// Primitive2DDecompositionVisitor
void BaseProcessor2D::visit(const primitive2d::Primitive2DReference& rCandidate)
{
- const primitive2d::BasePrimitive2D* pBasePrimitive = static_cast< const primitive2d::BasePrimitive2D* >(rCandidate.get());
- processBasePrimitive2D(*pBasePrimitive);
+ processBasePrimitive2D(*rCandidate);
}
void BaseProcessor2D::visit(const primitive2d::Primitive2DContainer& rContainer)
{
@@ -64,9 +64,8 @@ namespace drawinglayer::processor2d
{
for (const primitive2d::Primitive2DReference& rCandidate : rSource)
{
- const primitive2d::BasePrimitive2D* pBasePrimitive = static_cast< const primitive2d::BasePrimitive2D* >(rCandidate.get());
- if (pBasePrimitive)
- processBasePrimitive2D(*pBasePrimitive);
+ if (rCandidate)
+ processBasePrimitive2D(*rCandidate);
}
}
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index c4ca011d30d1..73a3332af221 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -620,9 +620,7 @@ void VclPixelProcessor2D::processUnifiedTransparencePrimitive2D(
if (1 == rContent.size())
{
- const primitive2d::Primitive2DReference xReference(rContent[0]);
- const primitive2d::BasePrimitive2D* pBasePrimitive
- = static_cast<const primitive2d::BasePrimitive2D*>(xReference.get());
+ const primitive2d::BasePrimitive2D* pBasePrimitive = rContent[0].get();
switch (pBasePrimitive->getPrimitive2DID())
{
diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
index b9159c46c73f..2b61acd19762 100644
--- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
@@ -34,6 +34,7 @@
#include <vcl/bitmapex.hxx>
#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <vcl/graph.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx
index 382b81197526..c0a92a8f479f 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -23,7 +23,10 @@
#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/processor2d/processor2dtools.hxx>
+#include <vcl/svapp.hxx>
#include <vcl/virdev.hxx>
+#include <com/sun/star/geometry/RealRectangle2D.hpp>
+#include <tools/diagnose_ex.h>
#include <drawinglayer/converters.hxx>
@@ -170,6 +173,100 @@ namespace drawinglayer
return aRetval;
}
+ BitmapEx convertPrimitive2DContainerToBitmapEx(
+ primitive2d::Primitive2DContainer&& rSequence,
+ const basegfx::B2DRange& rTargetRange,
+ sal_uInt32 nMaximumQuadraticPixels,
+ const o3tl::Length eTargetUnit,
+ const std::optional<Size>& rTargetDPI)
+ {
+ if(rSequence.empty())
+ return BitmapEx();
+
+ try
+ {
+ css::geometry::RealRectangle2D aRealRect;
+ aRealRect.X1 = rTargetRange.getMinX();
+ aRealRect.Y1 = rTargetRange.getMinY();
+ aRealRect.X2 = rTargetRange.getMaxX();
+ aRealRect.Y2 = rTargetRange.getMaxY();
+
+ // get system DPI
+ Size aDPI(Application::GetDefaultDevice()->LogicToPixel(Size(1, 1), MapMode(MapUnit::MapInch)));
+ if (rTargetDPI.has_value())
+ {
+ aDPI = *rTargetDPI;
+ }
+
+ ::sal_uInt32 DPI_X = aDPI.getWidth();
+ ::sal_uInt32 DPI_Y = aDPI.getHeight();
+ const basegfx::B2DRange aRange(aRealRect.X1, aRealRect.Y1, aRealRect.X2, aRealRect.Y2);
+ const double fWidth(aRange.getWidth());
+ const double fHeight(aRange.getHeight());
+
+ if(!(basegfx::fTools::more(fWidth, 0.0) && basegfx::fTools::more(fHeight, 0.0)))
+ return BitmapEx();
+
+ if(0 == DPI_X)
+ {
+ DPI_X = 75;
+ }
+
+ if(0 == DPI_Y)
+ {
+ DPI_Y = 75;
+ }
+
+ if(0 == nMaximumQuadraticPixels)
+ {
+ nMaximumQuadraticPixels = 500000;
+ }
+
+ const auto aViewInformation2D = geometry::createViewInformation2D({});
+ const sal_uInt32 nDiscreteWidth(basegfx::fround(o3tl::convert(fWidth, eTargetUnit, o3tl::Length::in) * DPI_X));
+ const sal_uInt32 nDiscreteHeight(basegfx::fround(o3tl::convert(fHeight, eTargetUnit, o3tl::Length::in) * DPI_Y));
+
+ basegfx::B2DHomMatrix aEmbedding(
+ basegfx::utils::createTranslateB2DHomMatrix(
+ -aRange.getMinX(),
+ -aRange.getMinY()));
+
+ aEmbedding.scale(
+ nDiscreteWidth / fWidth,
+ nDiscreteHeight / fHeight);
+
+ const primitive2d::Primitive2DReference xEmbedRef(
+ new primitive2d::TransformPrimitive2D(
+ aEmbedding,
+ std::move(rSequence)));
+ primitive2d::Primitive2DContainer xEmbedSeq { xEmbedRef };
+
+ BitmapEx aBitmapEx(
+ convertToBitmapEx(
+ std::move(xEmbedSeq),
+ aViewInformation2D,
+ nDiscreteWidth,
+ nDiscreteHeight,
+ nMaximumQuadraticPixels));
+
+ if(aBitmapEx.IsEmpty())
+ return BitmapEx();
+ aBitmapEx.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
+ aBitmapEx.SetPrefSize(Size(basegfx::fround(fWidth), basegfx::fround(fHeight)));
+
+ return aBitmapEx;
+ }
+ catch (const css::uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("vcl", "Got no graphic::XPrimitive2DRenderer!");
+ }
+ catch (const std::exception& e)
+ {
+ SAL_WARN("vcl", "Got no graphic::XPrimitive2DRenderer! : " << e.what());
+ }
+
+ return BitmapEx();
+ }
} // end of namespace drawinglayer
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx b/drawinglayer/source/tools/primitive2dxmldump.cxx
index 5f753039183c..5f303a627e0f 100644
--- a/drawinglayer/source/tools/primitive2dxmldump.cxx
+++ b/drawinglayer/source/tools/primitive2dxmldump.cxx
@@ -605,10 +605,7 @@ void Primitive2dXmlDump::decomposeAndWrite(
{
for (size_t i = 0; i < rPrimitive2DSequence.size(); i++)
{
- drawinglayer::primitive2d::Primitive2DReference xPrimitive2DReference
- = rPrimitive2DSequence[i];
- const BasePrimitive2D* pBasePrimitive
- = static_cast<const BasePrimitive2D*>(xPrimitive2DReference.get());
+ const BasePrimitive2D* pBasePrimitive = rPrimitive2DSequence[i].get();
sal_uInt32 nId = pBasePrimitive->getPrimitive2DID();
if (nId < maFilter.size() && maFilter[nId])
continue;
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx
index f8c562ce1a7a..307da099a774 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -1257,7 +1257,7 @@ namespace wmfemfhelper
// prepare Primitive2DSequence, put text in foreground
drawinglayer::primitive2d::Primitive2DContainer aSequence(2);
- aSequence[1] = drawinglayer::primitive2d::Primitive2DReference(pResult);
+ aSequence[1] = pResult;
// prepare filled polygon
basegfx::B2DPolygon aOutline(basegfx::utils::createPolygonFromRect(aTextRange));