diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-25 09:54:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-08 10:40:57 +0000 |
commit | f2beebbfe78bfd5dd26318ea269f49aeee6bd642 (patch) | |
tree | afd9820842752f252409590e323f72cdbd0a4c3c /drawinglayer | |
parent | ab731b192f40fde71c796ecab563adc8d7258da8 (diff) |
reduce copying when decomposing drawinglayer primitives
instead of returning a Primitive2DContainer from each method which we
are then going to immediately append to another container, pass down a
single container by reference which we can append to
Change-Id: I0f28a499d2ec54f7111a7044c30099767aa079e1
Reviewed-on: https://gerrit.libreoffice.org/30258
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer')
47 files changed, 294 insertions, 499 deletions
diff --git a/drawinglayer/qa/unit/border.cxx b/drawinglayer/qa/unit/border.cxx index 7e8791d19faa..60a698927143 100644 --- a/drawinglayer/qa/unit/border.cxx +++ b/drawinglayer/qa/unit/border.cxx @@ -62,7 +62,8 @@ void DrawinglayerBorderTest::testDoubleDecompositionSolid() // Decompose it into polygons. drawinglayer::geometry::ViewInformation2D aView; - drawinglayer::primitive2d::Primitive2DContainer aContainer = aBorder->get2DDecomposition(aView); + drawinglayer::primitive2d::Primitive2DContainer aContainer; + aBorder->get2DDecomposition(aContainer, aView); // Make sure it results in two borders as it's a double one. CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(2), aContainer.size()); diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx index 2ea970a84ea0..713c4bd52bcd 100644 --- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx @@ -70,7 +70,7 @@ namespace drawinglayer return false; } - Primitive2DContainer AnimatedSwitchPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void AnimatedSwitchPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { if(!getChildren().empty()) { @@ -84,10 +84,8 @@ namespace drawinglayer } const Primitive2DReference xRef(getChildren()[nIndex], uno::UNO_QUERY_THROW); - return Primitive2DContainer { xRef }; + rContainer.push_back(xRef); } - - return Primitive2DContainer(); } // provide unique ID @@ -108,7 +106,7 @@ namespace drawinglayer { } - Primitive2DContainer AnimatedBlinkPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void AnimatedBlinkPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { if(!getChildren().empty()) { @@ -116,11 +114,9 @@ namespace drawinglayer if(fState < 0.5) { - return getChildren(); + getChildren(rContainer); } } - - return Primitive2DContainer(); } // provide unique ID @@ -151,7 +147,7 @@ namespace drawinglayer } } - Primitive2DContainer AnimatedInterpolatePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void AnimatedInterpolatePrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { const sal_uInt32 nSize(maMatrixStack.size()); @@ -198,11 +194,11 @@ namespace drawinglayer // create new transform primitive reference, return new sequence const Primitive2DReference xRef(new TransformPrimitive2D(aTargetTransform, getChildren())); - return Primitive2DContainer { xRef }; + rContainer.push_back(xRef); } else { - return getChildren(); + getChildren(rContainer); } } diff --git a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx index 7086a3cec354..20afb0df0de8 100644 --- a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx @@ -33,17 +33,12 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer BackgroundColorPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void BackgroundColorPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { if(!rViewInformation.getViewport().isEmpty()) { const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(rViewInformation.getViewport())); - const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aOutline), getBColor())); - return Primitive2DContainer { xRef }; - } - else - { - return Primitive2DContainer(); + rContainer.push_back(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aOutline), getBColor())); } } @@ -75,7 +70,7 @@ namespace drawinglayer return rViewInformation.getViewport(); } - Primitive2DContainer BackgroundColorPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void BackgroundColorPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); @@ -92,7 +87,7 @@ namespace drawinglayer } // use parent implementation - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx b/drawinglayer/source/primitive2d/baseprimitive2d.cxx index 84833c36966a..bcc96c731b8e 100644 --- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx @@ -52,18 +52,21 @@ namespace drawinglayer basegfx::B2DRange BasePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { - return get2DDecomposition(rViewInformation).getB2DRange(rViewInformation); + Primitive2DContainer aContainer; + get2DDecomposition(aContainer, rViewInformation); + return aContainer.getB2DRange(rViewInformation); } - Primitive2DContainer BasePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void BasePrimitive2D::get2DDecomposition(Primitive2DContainer& /*rContainer*/, const geometry::ViewInformation2D& /*rViewInformation*/) const { - return Primitive2DContainer(); } Primitive2DSequence SAL_CALL BasePrimitive2D::getDecomposition( const uno::Sequence< beans::PropertyValue >& rViewParameters ) throw ( uno::RuntimeException, std::exception ) { const geometry::ViewInformation2D aViewInformation(rViewParameters); - return comphelper::containerToSequence(get2DDecomposition(aViewInformation)); + Primitive2DContainer aContainer; + get2DDecomposition(aContainer, aViewInformation); + return comphelper::containerToSequence(aContainer); } css::geometry::RealRectangle2D SAL_CALL BasePrimitive2D::getRange( const uno::Sequence< beans::PropertyValue >& rViewParameters ) throw ( uno::RuntimeException, std::exception ) @@ -85,9 +88,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer BufferedDecompositionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void BufferedDecompositionPrimitive2D::create2DDecomposition(Primitive2DContainer& /*rContainer*/, const geometry::ViewInformation2D& /*rViewInformation*/) const { - return Primitive2DContainer(); } BufferedDecompositionPrimitive2D::BufferedDecompositionPrimitive2D() @@ -96,17 +98,18 @@ namespace drawinglayer { } - Primitive2DContainer BufferedDecompositionPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void BufferedDecompositionPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); if(getBuffered2DDecomposition().empty()) { - const Primitive2DContainer aNewSequence(create2DDecomposition(rViewInformation)); + Primitive2DContainer aNewSequence; + create2DDecomposition(aNewSequence, rViewInformation); const_cast< BufferedDecompositionPrimitive2D* >(this)->setBuffered2DDecomposition(aNewSequence); } - return getBuffered2DDecomposition(); + rContainer.insert(rContainer.end(), getBuffered2DDecomposition().begin(), getBuffered2DDecomposition().end()); } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx index 63736d6d2ee1..671143f309fa 100644 --- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx @@ -174,15 +174,13 @@ primitive2d::Primitive2DReference makeSolidLinePrimitive( return basegfx::B2DPolyPolygon( clipPolygon ); } - Primitive2DContainer BorderLinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void BorderLinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { - return createDecomposition(rViewInformation, false); + createDecomposition(rContainer, rViewInformation, false); } - Primitive2DContainer BorderLinePrimitive2D::createDecomposition(const geometry::ViewInformation2D& rViewInformation, bool bPixelCorrection) const + void BorderLinePrimitive2D::createDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation, bool bPixelCorrection) const { - Primitive2DContainer xRetval; - if(!getStart().equal(getEnd()) && ( isInsideUsed() || isOutsideUsed() ) ) { // get data and vectors @@ -199,8 +197,6 @@ primitive2d::Primitive2DReference makeSolidLinePrimitive( const basegfx::B2DPoint aTmpStart(getStart() - (fExt * aVector)); const basegfx::B2DPoint aTmpEnd(getEnd() + (fExt * aVector)); - xRetval.resize(2); - double fLeftWidth = getLeftWidth(); bool bLeftHairline = lcl_UseHairline(fLeftWidth, getStart(), getEnd(), rViewInformation); if (bLeftHairline) @@ -214,25 +210,25 @@ primitive2d::Primitive2DReference makeSolidLinePrimitive( // "inside" line if (bLeftHairline) - xRetval[0] = makeHairLinePrimitive( - getStart(), getEnd(), aVector, getRGBColorLeft(), 0.0); + rContainer.push_back(makeHairLinePrimitive( + getStart(), getEnd(), aVector, getRGBColorLeft(), 0.0)); else { double fWidth = bPixelCorrection ? std::round(fLeftWidth) : fLeftWidth; - xRetval[0] = makeSolidLinePrimitive( - aClipRegion, aTmpStart, aTmpEnd, aVector, getRGBColorLeft(), fWidth, -fLeftWidth/2.0); + rContainer.push_back(makeSolidLinePrimitive( + aClipRegion, aTmpStart, aTmpEnd, aVector, getRGBColorLeft(), fWidth, -fLeftWidth/2.0)); } // "outside" line if (bRightHairline) - xRetval[1] = makeHairLinePrimitive( - getStart(), getEnd(), aVector, getRGBColorRight(), fLeftWidth+mfDistance); + rContainer.push_back(makeHairLinePrimitive( + getStart(), getEnd(), aVector, getRGBColorRight(), fLeftWidth+mfDistance)); else { double fWidth = bPixelCorrection ? std::round(fRightWidth) : fRightWidth; - xRetval[1] = makeSolidLinePrimitive( - aClipRegion, aTmpStart, aTmpEnd, aVector, getRGBColorRight(), fWidth, mfDistance+fRightWidth/2.0); + rContainer.push_back(makeSolidLinePrimitive( + aClipRegion, aTmpStart, aTmpEnd, aVector, getRGBColorRight(), fWidth, mfDistance+fRightWidth/2.0)); } } else @@ -263,8 +259,7 @@ primitive2d::Primitive2DReference makeSolidLinePrimitive( aPolygon.append( getStart() ); aPolygon.append( getEnd() ); - xRetval.resize(1); - xRetval[0] = Primitive2DReference(new PolygonHairlinePrimitive2D( + rContainer.push_back(new PolygonHairlinePrimitive2D( aPolygon, aColor)); } @@ -300,7 +295,6 @@ primitive2d::Primitive2DReference makeSolidLinePrimitive( } sal_uInt32 n = aDashed.count(); - xRetval.resize(n); for (sal_uInt32 i = 0; i < n; ++i) { basegfx::B2DPolygon aDash = aDashed.getB2DPolygon(i); @@ -311,20 +305,18 @@ primitive2d::Primitive2DReference makeSolidLinePrimitive( basegfx::B2DRange aRange = aDash.getB2DRange(); aDash2.append(basegfx::B2DPoint(aRange.getMinX(), aRange.getMinY())); aDash2.append(basegfx::B2DPoint(aRange.getMaxX(), aRange.getMinY())); - xRetval[i] = Primitive2DReference( + rContainer.push_back( new PolygonHairlinePrimitive2D(aDash2, aColor)); } else { - xRetval[i] = Primitive2DReference( + rContainer.push_back( new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aDash), aColor)); } } } } } - - return xRetval; } BorderLinePrimitive2D::BorderLinePrimitive2D( diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index 6a62af0ad014..8a06c039a235 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -237,7 +237,7 @@ namespace drawinglayer return xRetval; } - Primitive2DContainer ControlPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void ControlPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { // try to create a bitmap decomposition. If that fails for some reason, // at least create a replacement decomposition. @@ -248,7 +248,7 @@ namespace drawinglayer xReference = createPlaceholderDecomposition(rViewInformation); } - return Primitive2DContainer { xReference }; + rContainer.push_back(xReference); } ControlPrimitive2D::ControlPrimitive2D( @@ -329,7 +329,7 @@ namespace drawinglayer return aRetval; } - Primitive2DContainer ControlPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void ControlPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) 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 @@ -352,7 +352,7 @@ namespace drawinglayer } // use parent implementation - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/cropprimitive2d.cxx b/drawinglayer/source/primitive2d/cropprimitive2d.cxx index 65648537dde0..c3644e269fd2 100644 --- a/drawinglayer/source/primitive2d/cropprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/cropprimitive2d.cxx @@ -66,10 +66,8 @@ namespace drawinglayer return false; } - Primitive2DContainer CropPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void CropPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DContainer xRetval; - if(!getChildren().empty()) { // get original object scale in unit coordinates (no mirroring) @@ -128,7 +126,7 @@ namespace drawinglayer { // the new range is completely inside the old range (unit range), // so no masking is needed - xRetval = Primitive2DContainer { xTransformPrimitive }; + rContainer.push_back(xTransformPrimitive); } else { @@ -142,13 +140,11 @@ namespace drawinglayer aMaskPolyPolygon, Primitive2DContainer { xTransformPrimitive })); - xRetval = Primitive2DContainer { xMask }; + rContainer.push_back(xMask); } } } } - - return xRetval; } // provide unique ID diff --git a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx index 6f8fc6274401..5d6310d8cb1a 100644 --- a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx @@ -26,12 +26,11 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer DiscreteBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void DiscreteBitmapPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { // use getViewTransformation() and getObjectTransformation() from // ObjectAndViewTransformationDependentPrimitive2D to create a BitmapPrimitive2D // with the correct mapping - Primitive2DContainer xRetval; if(!getBitmapEx().IsEmpty()) { @@ -65,11 +64,8 @@ namespace drawinglayer aObjectTransform = aInverseObjectTransformation * aObjectTransform; // create BitmapPrimitive2D with now object-local coordinate data - const Primitive2DReference xRef(new BitmapPrimitive2D(getBitmapEx(), aObjectTransform)); - xRetval = Primitive2DContainer { xRef }; + rContainer.push_back(new BitmapPrimitive2D(getBitmapEx(), aObjectTransform)); } - - return xRetval; } DiscreteBitmapPrimitive2D::DiscreteBitmapPrimitive2D( diff --git a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx index b4cb1f4ee3a9..95acd391f4cf 100644 --- a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx @@ -161,7 +161,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer DiscreteShadowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void DiscreteShadowPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DContainer xRetval; @@ -259,15 +259,11 @@ namespace drawinglayer fBorderY + fSingleY))); // put all in object transformation to get to target positions - const Primitive2DReference xTransformed( + rContainer.push_back( new TransformPrimitive2D( getTransform(), xRetval)); - - xRetval = Primitive2DContainer { xTransformed }; } - - return xRetval; } DiscreteShadowPrimitive2D::DiscreteShadowPrimitive2D( diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx index 4cca95c15fda..8b557ceb83c3 100644 --- a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx @@ -63,15 +63,13 @@ namespace drawinglayer return !maShadowPrimitives.empty(); } - Primitive2DContainer Embedded3DPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void Embedded3DPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) 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::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aLocal2DRange)); const basegfx::BColor aYellow(1.0, 1.0, 0.0); - const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aOutline, aYellow)); - - return Primitive2DContainer { xRef }; + rContainer.push_back(new PolygonHairlinePrimitive2D(aOutline, aYellow)); } Embedded3DPrimitive2D::Embedded3DPrimitive2D( diff --git a/drawinglayer/source/primitive2d/epsprimitive2d.cxx b/drawinglayer/source/primitive2d/epsprimitive2d.cxx index 6d29e7a5afbb..197a0b1d9032 100644 --- a/drawinglayer/source/primitive2d/epsprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/epsprimitive2d.cxx @@ -25,9 +25,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer EpsPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void EpsPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DContainer xRetval; const GDIMetaFile& rSubstituteContent = getMetaFile(); if( rSubstituteContent.GetActionSize() ) @@ -35,15 +34,12 @@ namespace drawinglayer // the default decomposition will use the Metafile replacement visualisation. // To really use the Eps data, a renderer has to know and interpret this primitive // directly. - xRetval.resize(1); - xRetval[0] = Primitive2DReference( + rContainer.push_back( new MetafilePrimitive2D( getEpsTransform(), rSubstituteContent)); } - - return xRetval; } EpsPrimitive2D::EpsPrimitive2D( diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index 4fba3c8c24b8..1848d0165369 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -148,17 +148,14 @@ namespace drawinglayer } } - Primitive2DContainer FillGradientPrimitive2D::createOverlappingFill( + void FillGradientPrimitive2D::createOverlappingFill( + Primitive2DContainer& rContainer, const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, const basegfx::BColor& rOuterColor, const basegfx::B2DPolygon& rUnitPolygon) const { - // prepare return value - Primitive2DContainer aRetval; - aRetval.resize(rEntries.size() + 1); - // create solid fill with outmost color - aRetval[0] = Primitive2DReference( + rContainer.push_back( new PolyPolygonColorPrimitive2D( basegfx::B2DPolyPolygon( basegfx::tools::createPolygonFromRect(getOutputRange())), @@ -173,24 +170,19 @@ namespace drawinglayer aNewPoly.transform(rEntries[a].maB2DHomMatrix); // create solid fill - aRetval[a + 1] = Primitive2DReference( + rContainer.push_back( new PolyPolygonColorPrimitive2D( basegfx::B2DPolyPolygon(aNewPoly), rEntries[a].maBColor)); } - - return aRetval; } - Primitive2DContainer FillGradientPrimitive2D::createNonOverlappingFill( + void FillGradientPrimitive2D::createNonOverlappingFill( + Primitive2DContainer& rContainer, const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, const basegfx::BColor& rOuterColor, const basegfx::B2DPolygon& rUnitPolygon) const { - // prepare return value - Primitive2DContainer aRetval; - aRetval.resize(rEntries.size() + 1); - // get outmost visible range from object basegfx::B2DRange aOutmostRange(getOutputRange()); basegfx::B2DPolyPolygon aCombinedPolyPoly; @@ -207,7 +199,7 @@ namespace drawinglayer // add outmost range to combined polypolygon (in 1st place), create first primitive aCombinedPolyPoly.insert(0, basegfx::tools::createPolygonFromRect(aOutmostRange)); - aRetval[0] = Primitive2DReference( + rContainer.push_back( new PolyPolygonColorPrimitive2D( aCombinedPolyPoly, rOuterColor)); @@ -226,7 +218,7 @@ namespace drawinglayer aCombinedPolyPoly.append(aNextPoly); // create primitive with correct color - aRetval[a + 1] = Primitive2DReference( + rContainer.push_back( new PolyPolygonColorPrimitive2D( aCombinedPolyPoly, rEntries[a].maBColor)); @@ -236,16 +228,14 @@ namespace drawinglayer } // add last inner polygon with last color - aRetval[rEntries.size()] = Primitive2DReference( + rContainer.push_back( new PolyPolygonColorPrimitive2D( aCombinedPolyPoly, rEntries[rEntries.size() - 1].maBColor)); } - - return aRetval; } - Primitive2DContainer FillGradientPrimitive2D::createFill(bool bOverlapping) const + void FillGradientPrimitive2D::createFill(Primitive2DContainer& rContainer, bool bOverlapping) const { // prepare shape of the Unit Polygon basegfx::B2DPolygon aUnitPolygon; @@ -274,15 +264,15 @@ namespace drawinglayer if(bOverlapping) { - return createOverlappingFill(aEntries, aOuterColor, aUnitPolygon); + createOverlappingFill(rContainer, aEntries, aOuterColor, aUnitPolygon); } else { - return createNonOverlappingFill(aEntries, aOuterColor, aUnitPolygon); + createNonOverlappingFill(rContainer, aEntries, aOuterColor, aUnitPolygon); } } - Primitive2DContainer FillGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void FillGradientPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { // default creates overlapping fill which works with AntiAliasing and without. // The non-overlapping version does not create single filled polygons, but @@ -295,11 +285,7 @@ namespace drawinglayer { static bool bOverlapping(true); // allow to test non-overlapping in the debugger - return createFill(bOverlapping); - } - else - { - return Primitive2DContainer(); + createFill(rContainer, bOverlapping); } } diff --git a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx index f90c9239de55..4f658322aab0 100644 --- a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx @@ -37,9 +37,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer FillGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void FillGraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DContainer aRetval; const attribute::FillGraphicAttribute& rAttribute = getFillGraphic(); if(!rAttribute.isDefault()) @@ -64,18 +63,18 @@ namespace drawinglayer // get matrices and realloc retval aTiling.appendTransformations(aMatrices); - aRetval.resize(aMatrices.size()); // prepare content primitive - const Primitive2DContainer xSeq = create2DDecompositionOfGraphic( + Primitive2DContainer xSeq; + create2DDecompositionOfGraphic(xSeq, rGraphic, basegfx::B2DHomMatrix()); for(size_t a(0); a < aMatrices.size(); a++) { - aRetval[a] = new TransformPrimitive2D( + rContainer.push_back(new TransformPrimitive2D( getTransformation() * aMatrices[a], - xSeq); + xSeq)); } } else @@ -86,15 +85,13 @@ namespace drawinglayer rAttribute.getGraphicRange().getRange(), rAttribute.getGraphicRange().getMinimum())); - aRetval = create2DDecompositionOfGraphic( + create2DDecompositionOfGraphic(rContainer, rGraphic, aObjectTransform); } } } } - - return aRetval; } FillGraphicPrimitive2D::FillGraphicPrimitive2D( diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx index 5e4a7cc4ae8c..c5eb9139993a 100644 --- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx @@ -35,10 +35,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer FillHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void FillHatchPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DContainer aRetval; - if(!getFillHatch().isDefault()) { // create hatch @@ -103,17 +101,15 @@ namespace drawinglayer // prepare return value const bool bFillBackground(getFillHatch().isFillBackground()); - aRetval.resize(bFillBackground ? aMatrices.size() + 1L : aMatrices.size()); // evtl. create filled background if(bFillBackground) { // create primitive for background - const Primitive2DReference xRef( + rContainer.push_back( new PolyPolygonColorPrimitive2D( basegfx::B2DPolyPolygon( basegfx::tools::createPolygonFromRect(getOutputRange())), getBColor())); - aRetval[0] = xRef; } // create primitives @@ -129,12 +125,9 @@ namespace drawinglayer aNewLine.append(rMatrix * aEnd); // create hairline - const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aNewLine, aHatchColor)); - aRetval[bFillBackground ? (a + 1) : a] = xRef; + rContainer.push_back(new PolygonHairlinePrimitive2D(aNewLine, aHatchColor)); } } - - return aRetval; } FillHatchPrimitive2D::FillHatchPrimitive2D( @@ -183,7 +176,7 @@ namespace drawinglayer return getOutputRange(); } - Primitive2DContainer FillHatchPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void FillHatchPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); bool bAdaptDistance(0 != getFillHatch().getMinimalDiscreteDistance()); @@ -191,12 +184,12 @@ namespace drawinglayer if(bAdaptDistance) { // behave view-dependent - return DiscreteMetricDependentPrimitive2D::get2DDecomposition(rViewInformation); + DiscreteMetricDependentPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } else { // behave view-independent - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } } diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index 94ae60c058a3..e0b344a32130 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -32,15 +32,12 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer GraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& - ) const + void GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& ) const { - Primitive2DContainer aRetval; - if(255L == getGraphicAttr().GetTransparency()) { // content is invisible, done - return aRetval; + return; } // do not apply mirroring from GraphicAttr to the Metafile by calling @@ -106,14 +103,16 @@ namespace drawinglayer // create sub-content; helper takes care of correct handling of // bitmap, svg or metafile content - aRetval = create2DDecompositionOfGraphic( + Primitive2DContainer aRetval; + create2DDecompositionOfGraphic( + aRetval, aTransformedGraphic, aTransform); if(!aRetval.size()) { // content is invisible, done - return aRetval; + return; } if(isAdjusted || isDrawMode) @@ -134,7 +133,7 @@ namespace drawinglayer if(!aRetval.size()) { // content is invisible, done - return aRetval; + return; } } @@ -182,7 +181,7 @@ namespace drawinglayer aRetval = Primitive2DContainer { xPrimitive }; } - return aRetval; + rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end()); } GraphicPrimitive2D::GraphicPrimitive2D( diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx index 5c278a553542..4c48cf70b815 100644 --- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -323,7 +323,7 @@ namespace drawinglayer virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; /// override to deliver the correct expected frame dependent of timing - virtual Primitive2DContainer get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override; + virtual void get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; }; AnimatedGraphicPrimitive2D::AnimatedGraphicPrimitive2D( @@ -392,11 +392,11 @@ namespace drawinglayer && getGraphic() == pCompare->getGraphic()); } - Primitive2DContainer AnimatedGraphicPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void AnimatedGraphicPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { if (isValidData()) { - Primitive2DContainer aRetval(1); + Primitive2DReference aRetval; const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime())); const sal_uInt32 nLen(maAnimation.Count()); sal_uInt32 nIndex(basegfx::fround(fState * (double)nLen)); @@ -409,11 +409,12 @@ namespace drawinglayer } // check buffering shortcuts, may already be created - aRetval[0] = tryTogetFromBuffer(nIndex); + aRetval = tryTogetFromBuffer(nIndex); - if (aRetval[0].is()) + if (aRetval.is()) { - return aRetval; + rContainer.push_back(aRetval); + return; } // if huge size (and not the buffered 1st frame) simply @@ -427,20 +428,19 @@ namespace drawinglayer const_cast<AnimatedGraphicPrimitive2D*>(this)->createFrame(nIndex); // try to get from buffer again, may have been added from createFrame - aRetval[0] = tryTogetFromBuffer(nIndex); + aRetval = tryTogetFromBuffer(nIndex); - if (aRetval[0].is()) + if (aRetval.is()) { - return aRetval; + rContainer.push_back(aRetval); + return; } // did not work (not buffered and not 1st frame), create from buffer - aRetval[0] = createFromBuffer(); + aRetval = createFromBuffer(); - return aRetval; + rContainer.push_back(aRetval); } - - return Primitive2DContainer(); } } // end of namespace primitive2d @@ -450,7 +450,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer create2DDecompositionOfGraphic( + void create2DDecompositionOfGraphic( + Primitive2DContainer& rContainer, const Graphic& rGraphic, const basegfx::B2DHomMatrix& rTransform) { @@ -546,7 +547,7 @@ namespace drawinglayer } } - return aRetval; + rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end()); } Primitive2DContainer create2DColorModifierEmbeddingsAsNeeded( diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx b/drawinglayer/source/primitive2d/gridprimitive2d.cxx index a74735c909d3..49594f455426 100644 --- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx @@ -33,10 +33,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer GridPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void GridPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DContainer aRetval; - if(!rViewInformation.getViewport().isEmpty() && getWidth() > 0.0 && getHeight() > 0.0) { // decompose grid matrix to get logic size @@ -229,15 +227,11 @@ namespace drawinglayer // prepare return value const sal_uInt32 nCountPoint(aPositionsPoint.size()); const sal_uInt32 nCountCross(aPositionsCross.size()); - const sal_uInt32 nRetvalCount((nCountPoint ? 1 : 0) + (nCountCross ? 1 : 0)); - sal_uInt32 nInsertCounter(0); - - aRetval.resize(nRetvalCount); // add PointArrayPrimitive2D if point markers were added if(nCountPoint) { - aRetval[nInsertCounter++] = Primitive2DReference(new PointArrayPrimitive2D(aPositionsPoint, getBColor())); + rContainer.push_back(new PointArrayPrimitive2D(aPositionsPoint, getBColor())); } // add MarkerArrayPrimitive2D if cross markers were added @@ -247,17 +241,15 @@ namespace drawinglayer { // no subdivisions, so fall back to points at grid positions, no need to // visualize a difference between divisions and sub-divisions - aRetval[nInsertCounter++] = Primitive2DReference(new PointArrayPrimitive2D(aPositionsCross, getBColor())); + rContainer.push_back(new PointArrayPrimitive2D(aPositionsCross, getBColor())); } else { - aRetval[nInsertCounter++] = Primitive2DReference(new MarkerArrayPrimitive2D(aPositionsCross, getCrossMarker())); + rContainer.push_back(new MarkerArrayPrimitive2D(aPositionsCross, getCrossMarker())); } } } } - - return aRetval; } GridPrimitive2D::GridPrimitive2D( @@ -317,7 +309,7 @@ namespace drawinglayer return aUnitRange; } - Primitive2DContainer GridPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void GridPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); @@ -338,7 +330,7 @@ namespace drawinglayer } // use parent implementation - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/groupprimitive2d.cxx b/drawinglayer/source/primitive2d/groupprimitive2d.cxx index b5582a0a3e08..fb3f6b9b794c 100644 --- a/drawinglayer/source/primitive2d/groupprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/groupprimitive2d.cxx @@ -51,9 +51,9 @@ namespace drawinglayer } /// default: just return children, so all renderers not supporting group will use its content - Primitive2DContainer GroupPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void GroupPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - return getChildren(); + getChildren(rContainer); } sal_Int64 SAL_CALL GroupPrimitive2D::estimateUsage() diff --git a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx index d51c4db65a52..b8cc0df1eafe 100644 --- a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx @@ -33,10 +33,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer HelplinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void HelplinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { - std::vector< BasePrimitive2D* > aTempPrimitiveTarget; - if(!rViewInformation.getViewport().isEmpty() && !getDirection().equalZero()) { // position to view coordinates, DashLen and DashLen in logic @@ -57,7 +55,7 @@ namespace drawinglayer aLineA.append(aEndA); aLineA.transform(rViewInformation.getInverseObjectToViewTransformation()); PolygonMarkerPrimitive2D* pNewA = new PolygonMarkerPrimitive2D(aLineA, getRGBColA(), getRGBColB(), getDiscreteDashLength()); - aTempPrimitiveTarget.push_back(pNewA); + rContainer.push_back(pNewA); const basegfx::B2DVector aPerpendicularNormalizedDirection(basegfx::getPerpendicular(aNormalizedDirection)); const basegfx::B2DPoint aStartB(aViewPosition - aPerpendicularNormalizedDirection); @@ -67,7 +65,7 @@ namespace drawinglayer aLineB.append(aEndB); aLineB.transform(rViewInformation.getInverseObjectToViewTransformation()); PolygonMarkerPrimitive2D* pNewB = new PolygonMarkerPrimitive2D(aLineB, getRGBColA(), getRGBColB(), getDiscreteDashLength()); - aTempPrimitiveTarget.push_back(pNewB); + rContainer.push_back(pNewB); break; } @@ -118,7 +116,7 @@ namespace drawinglayer basegfx::B2DPolygon aPart(aResult.getB2DPolygon(a)); aPart.transform(rViewInformation.getInverseObjectToViewTransformation()); PolygonMarkerPrimitive2D* pNew = new PolygonMarkerPrimitive2D(aPart, getRGBColA(), getRGBColB(), getDiscreteDashLength()); - aTempPrimitiveTarget.push_back(pNew); + rContainer.push_back(pNew); } } @@ -126,17 +124,6 @@ namespace drawinglayer } } } - - // prepare return value - Primitive2DContainer aRetval(aTempPrimitiveTarget.size()); - - for(size_t a(0); a < aTempPrimitiveTarget.size(); a++) - { - const Primitive2DReference xRef(aTempPrimitiveTarget[a]); - aRetval[a] = xRef; - } - - return aRetval; } HelplinePrimitive2D::HelplinePrimitive2D( @@ -175,7 +162,7 @@ namespace drawinglayer return false; } - Primitive2DContainer HelplinePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void HelplinePrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); @@ -196,7 +183,7 @@ namespace drawinglayer } // use parent implementation - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx b/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx index 7fa01510a813..f437a3fa8a0c 100644 --- a/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx @@ -39,9 +39,8 @@ namespace drawinglayer return getChildren().getB2DRange(rViewInformation); } - Primitive2DContainer HiddenGeometryPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void HiddenGeometryPrimitive2D::get2DDecomposition(Primitive2DContainer& /*rContainer*/, const geometry::ViewInformation2D& /*rViewInformation*/) const { - return Primitive2DContainer(); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx index 465ea68a093d..f7d4e619488d 100644 --- a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx @@ -34,9 +34,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer MarkerArrayPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void MarkerArrayPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DContainer xRetval; const std::vector< basegfx::B2DPoint >& rPositions = getPositions(); const sal_uInt32 nMarkerCount(rPositions.size()); @@ -54,9 +53,6 @@ namespace drawinglayer // use half size for expand aLogicHalfSize *= 0.5; - // number of primitives is known; realloc accordingly - xRetval.resize(nMarkerCount); - for(sal_uInt32 a(0); a < nMarkerCount; a++) { const basegfx::B2DPoint& rPosition(rPositions[a]); @@ -68,12 +64,10 @@ namespace drawinglayer aTransform.set(0, 2, aRange.getMinX()); aTransform.set(1, 2, aRange.getMinY()); - xRetval[a] = Primitive2DReference(new BitmapPrimitive2D(getMarker(), aTransform)); + rContainer.push_back(new BitmapPrimitive2D(getMarker(), aTransform)); } } } - - return xRetval; } MarkerArrayPrimitive2D::MarkerArrayPrimitive2D( diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx index 620ecdfe1a11..0578907ab340 100644 --- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx @@ -33,7 +33,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer MediaPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void MediaPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { Primitive2DContainer xRetval; xRetval.resize(1); @@ -90,7 +90,7 @@ namespace drawinglayer } } - return xRetval; + rContainer.insert(rContainer.end(), xRetval.begin(), xRetval.end()); } MediaPrimitive2D::MediaPrimitive2D( diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index de1c22bba9b0..00cfdbfe72ea 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -528,7 +528,7 @@ namespace drawinglayer { protected: /// local decomposition. - virtual Primitive2DContainer create2DDecomposition( + virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override; public: @@ -541,16 +541,13 @@ namespace drawinglayer } }; - Primitive2DContainer NonOverlappingFillGradientPrimitive2D::create2DDecomposition( + void NonOverlappingFillGradientPrimitive2D::create2DDecomposition( + Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { if(!getFillGradient().isDefault()) { - return createFill(false); - } - else - { - return Primitive2DContainer(); + createFill(rContainer, false); } } } // end of namespace primitive2d @@ -3165,7 +3162,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer MetafilePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void MetafilePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { // prepare target and porperties; each will have one default entry TargetHolders aTargetHolders; @@ -3214,7 +3211,7 @@ namespace drawinglayer xRetval = Primitive2DContainer { aEmbeddedTransform }; } - return xRetval; + rContainer.insert(rContainer.end(), xRetval.begin(), xRetval.end()); } MetafilePrimitive2D::MetafilePrimitive2D( diff --git a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx index 5cb7232e9af0..1b8c941537e7 100644 --- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx @@ -33,9 +33,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer PagePreviewPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void PagePreviewPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DContainer xRetval; Primitive2DContainer aContent(getPageContent()); if(!aContent.empty() @@ -98,12 +97,9 @@ namespace drawinglayer aPageTrans = aCombined * aPageTrans; // embed in necessary transformation to map from SdrPage to SdrPageObject - const Primitive2DReference xReferenceB(new TransformPrimitive2D(aPageTrans, aContent)); - xRetval = Primitive2DContainer { xReferenceB }; + rContainer.push_back(new TransformPrimitive2D(aPageTrans, aContent)); } } - - return xRetval; } PagePreviewPrimitive2D::PagePreviewPrimitive2D( diff --git a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx index 82d397d2c293..7faa924fb529 100644 --- a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx @@ -159,7 +159,7 @@ namespace drawinglayer return aContent; } - Primitive2DContainer PatternFillPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void PatternFillPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { Primitive2DContainer aRetval; @@ -208,19 +208,15 @@ namespace drawinglayer // embed result in mask { - const Primitive2DReference xRef( + rContainer.push_back( new MaskPrimitive2D( getMask(), aRetval)); - - aRetval = Primitive2DContainer { xRef }; } } } } - - return aRetval; } PatternFillPrimitive2D::PatternFillPrimitive2D( @@ -255,7 +251,7 @@ namespace drawinglayer return getMask().getB2DRange(); } - Primitive2DContainer PatternFillPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void PatternFillPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { // The existing bufferd decomposition uses a buffer in the remembered // size or none if sizes are zero. Get new needed sizes which depend on @@ -311,7 +307,7 @@ namespace drawinglayer } // call parent - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } sal_Int64 SAL_CALL PatternFillPrimitive2D::estimateUsage() diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index 76fc498d34d5..2ebd32a4f5e0 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -91,7 +91,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer PolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void PolygonMarkerPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { // calculate logic DashLength const basegfx::B2DVector aDashVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(getDiscreteDashLength(), 0.0)); @@ -108,18 +108,12 @@ namespace drawinglayer aDash.push_back(fLogicDashLength); basegfx::tools::applyLineDashing(getB2DPolygon(), aDash, &aDashedPolyPolyA, &aDashedPolyPolyB, 2.0 * fLogicDashLength); - // prepare return value - Primitive2DContainer aRetval(2); - - aRetval[0] = Primitive2DReference(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyA, getRGBColorA())); - aRetval[1] = Primitive2DReference(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyB, getRGBColorB())); - - return aRetval; + rContainer.push_back(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyA, getRGBColorA())); + rContainer.push_back(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyB, getRGBColorB())); } else { - const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(getB2DPolygon(), getRGBColorA())); - return Primitive2DContainer { xRef }; + rContainer.push_back(new PolygonHairlinePrimitive2D(getB2DPolygon(), getRGBColorA())); } } @@ -174,7 +168,7 @@ namespace drawinglayer return aRetval; } - Primitive2DContainer PolygonMarkerPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void PolygonMarkerPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); bool bNeedNewDecomposition(false); @@ -201,7 +195,7 @@ namespace drawinglayer } // use parent implementation - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } // provide unique ID @@ -222,7 +216,7 @@ namespace drawinglayer namespace primitive2d { - Primitive2DContainer PolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void PolygonStrokePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { if(getB2DPolygon().count()) { @@ -267,9 +261,6 @@ namespace drawinglayer fMiterMinimumAngle)); } - // prepare return value - Primitive2DContainer aRetval(aAreaPolyPolygon.count()); - // create primitive for(sal_uInt32 b(0L); b < aAreaPolyPolygon.count(); b++) { @@ -281,27 +272,17 @@ namespace drawinglayer const basegfx::BColor aColor(bTestByUsingRandomColor ? basegfx::BColor(tools::getRandomColorRange(), tools::getRandomColorRange(), tools::getRandomColorRange()) : getLineAttribute().getColor()); - const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(aNewPolyPolygon, aColor)); - aRetval[b] = xRef; + rContainer.push_back(new PolyPolygonColorPrimitive2D(aNewPolyPolygon, aColor)); } - - return aRetval; } else { - // prepare return value - const Primitive2DReference xRef( + rContainer.push_back( new PolyPolygonHairlinePrimitive2D( aHairLinePolyPolygon, getLineAttribute().getColor())); - - return Primitive2DContainer { xRef }; } } - else - { - return Primitive2DContainer(); - } } PolygonStrokePrimitive2D::PolygonStrokePrimitive2D( @@ -410,10 +391,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer PolygonWavePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void PolygonWavePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DContainer aRetval; - if(getB2DPolygon().count()) { const bool bHasWidth(!basegfx::fTools::equalZero(getWaveWidth())); @@ -423,18 +402,14 @@ namespace drawinglayer { // create waveline curve const basegfx::B2DPolygon aWaveline(basegfx::tools::createWaveline(getB2DPolygon(), getWaveWidth(), getWaveHeight())); - const Primitive2DReference xRef(new PolygonStrokePrimitive2D(aWaveline, getLineAttribute(), getStrokeAttribute())); - aRetval = Primitive2DContainer { xRef }; + rContainer.push_back(new PolygonStrokePrimitive2D(aWaveline, getLineAttribute(), getStrokeAttribute())); } else { // flat waveline, decompose to simple line primitive - const Primitive2DReference xRef(new PolygonStrokePrimitive2D(getB2DPolygon(), getLineAttribute(), getStrokeAttribute())); - aRetval = Primitive2DContainer { xRef }; + rContainer.push_back(new PolygonStrokePrimitive2D(getB2DPolygon(), getLineAttribute(), getStrokeAttribute())); } } - - return aRetval; } PolygonWavePrimitive2D::PolygonWavePrimitive2D( @@ -522,7 +497,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer PolygonStrokeArrowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void PolygonStrokeArrowPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { // copy local polygon, it may be changed basegfx::B2DPolygon aLocalPolygon(getB2DPolygon()); @@ -569,33 +544,24 @@ namespace drawinglayer } } - // prepare return value - Primitive2DContainer aRetval(1L + (aArrowA.count() ? 1L : 0L) + (aArrowB.count() ? 1L : 0L)); - sal_uInt32 nInd(0L); - // add shaft - const Primitive2DReference xRefShaft(new + rContainer.push_back(new PolygonStrokePrimitive2D( aLocalPolygon, getLineAttribute(), getStrokeAttribute())); - aRetval[nInd++] = xRefShaft; if(aArrowA.count()) { - const Primitive2DReference xRefA( + rContainer.push_back( new PolyPolygonColorPrimitive2D( aArrowA, getLineAttribute().getColor())); - aRetval[nInd++] = xRefA; } if(aArrowB.count()) { - const Primitive2DReference xRefB( + rContainer.push_back( new PolyPolygonColorPrimitive2D( aArrowB, getLineAttribute().getColor())); - aRetval[nInd++] = xRefB; } - - return aRetval; } PolygonStrokeArrowPrimitive2D::PolygonStrokeArrowPrimitive2D( diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index 921359608e2a..87bdcb4dc2e5 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -40,25 +40,17 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer PolyPolygonHairlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void PolyPolygonHairlinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); if(nCount) { - Primitive2DContainer aRetval(nCount); - for(sal_uInt32 a(0L); a < nCount; a++) { - aRetval[a] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolyPolygon.getB2DPolygon(a), getBColor())); + rContainer.push_back(new PolygonHairlinePrimitive2D(aPolyPolygon.getB2DPolygon(a), getBColor())); } - - return aRetval; - } - else - { - return Primitive2DContainer(); } } @@ -99,30 +91,22 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer PolyPolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void PolyPolygonMarkerPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); if(nCount) { - Primitive2DContainer aRetval(nCount); - for(sal_uInt32 a(0L); a < nCount; a++) { - aRetval[a] = Primitive2DReference( + rContainer.push_back( new PolygonMarkerPrimitive2D( aPolyPolygon.getB2DPolygon(a), getRGBColorA(), getRGBColorB(), getDiscreteDashLength())); } - - return aRetval; - } - else - { - return Primitive2DContainer(); } } @@ -171,27 +155,19 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer PolyPolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void PolyPolygonStrokePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); if(nCount) { - Primitive2DContainer aRetval(nCount); - for(sal_uInt32 a(0L); a < nCount; a++) { - aRetval[a] = Primitive2DReference( + rContainer.push_back( new PolygonStrokePrimitive2D( aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute())); } - - return aRetval; - } - else - { - return Primitive2DContainer(); } } @@ -294,7 +270,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void PolyPolygonGradientPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { if(!getFillGradient().isDefault()) { @@ -308,14 +284,7 @@ namespace drawinglayer const Primitive2DContainer aSubSequence { xSubRef }; // create mask primitive - MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); - const Primitive2DReference xRef(pNewMask); - - return Primitive2DContainer { xRef }; - } - else - { - return Primitive2DContainer(); + rContainer.push_back(new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence)); } } @@ -365,7 +334,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void PolyPolygonHatchPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { if(!getFillHatch().isDefault()) { @@ -380,14 +349,7 @@ namespace drawinglayer const Primitive2DContainer aSubSequence { xSubRef }; // create mask primitive - MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); - const Primitive2DReference xRef(pNewMask); - - return Primitive2DContainer { xRef }; - } - else - { - return Primitive2DContainer(); + rContainer.push_back(new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence)); } } @@ -442,7 +404,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer PolyPolygonGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void PolyPolygonGraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { if(!getFillGraphic().isDefault()) { @@ -510,17 +472,13 @@ namespace drawinglayer } // embed to mask primitive - const Primitive2DReference xRef( + rContainer.push_back( new MaskPrimitive2D( getB2DPolyPolygon(), Primitive2DContainer { xSubRef })); - - return Primitive2DContainer { xRef }; } } } - - return Primitive2DContainer(); } PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D( @@ -569,7 +527,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer PolyPolygonSelectionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void PolyPolygonSelectionPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DContainer aRetval; @@ -611,7 +569,7 @@ namespace drawinglayer } } - return aRetval; + rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end()); } PolyPolygonSelectionPrimitive2D::PolyPolygonSelectionPrimitive2D( diff --git a/drawinglayer/source/primitive2d/primitivetools2d.cxx b/drawinglayer/source/primitive2d/primitivetools2d.cxx index 591e744cffc0..509bff79a83e 100644 --- a/drawinglayer/source/primitive2d/primitivetools2d.cxx +++ b/drawinglayer/source/primitive2d/primitivetools2d.cxx @@ -26,7 +26,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer DiscreteMetricDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void DiscreteMetricDependentPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); @@ -47,7 +47,7 @@ namespace drawinglayer } // call base implementation - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } } // end of namespace primitive2d } // end of namespace drawinglayer @@ -57,7 +57,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer ViewportDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void ViewportDependentPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); @@ -77,7 +77,7 @@ namespace drawinglayer } // call base implementation - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } } // end of namespace primitive2d } // end of namespace drawinglayer @@ -87,7 +87,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer ViewTransformationDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void ViewTransformationDependentPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); @@ -107,7 +107,7 @@ namespace drawinglayer } // call base implementation - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } } // end of namespace primitive2d } // end of namespace drawinglayer @@ -117,7 +117,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer ObjectAndViewTransformationDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void ObjectAndViewTransformationDependentPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); @@ -147,7 +147,7 @@ namespace drawinglayer } // call base implementation - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index d863d21eb7a5..63d30349c0d4 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -221,7 +221,7 @@ namespace drawinglayer } } - Primitive2DContainer ScenePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void ScenePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { Primitive2DContainer aRetval; @@ -494,7 +494,7 @@ namespace drawinglayer } } - return aRetval; + rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end()); } Primitive2DContainer ScenePrimitive2D::getGeometry2D() const @@ -638,7 +638,7 @@ namespace drawinglayer return aRetval; } - Primitive2DContainer ScenePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void ScenePrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); @@ -695,7 +695,7 @@ namespace drawinglayer } // use parent implementation - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx index d50e9d2f3d37..f1e4b9f03118 100644 --- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx @@ -64,10 +64,8 @@ namespace drawinglayer return aRetval; } - Primitive2DContainer ShadowPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void ShadowPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DContainer aRetval; - if(!getChildren().empty()) { // create a modifiedColorPrimitive containing the shadow color and the content @@ -81,11 +79,8 @@ namespace drawinglayer const Primitive2DContainer aSequenceB { xRefA }; // build transformed primitiveVector with shadow offset and add to target - const Primitive2DReference xRefB(new TransformPrimitive2D(getShadowTransform(), aSequenceB)); - aRetval = Primitive2DContainer { xRefB }; + rContainer.push_back(new TransformPrimitive2D(getShadowTransform(), aSequenceB)); } - - return aRetval; } // provide unique ID diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx index 4283610901b2..9721e4e06c85 100644 --- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx @@ -62,11 +62,10 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer SvgGradientHelper::createSingleGradientEntryFill() const + void SvgGradientHelper::createSingleGradientEntryFill(Primitive2DContainer& rContainer) const { const SvgGradientEntryVector& rEntries = getGradientEntries(); const sal_uInt32 nCount(rEntries.size()); - Primitive2DContainer xRetval; if(nCount) { @@ -90,15 +89,13 @@ namespace drawinglayer 1.0 - fOpacity)); } - xRetval = Primitive2DContainer { xRef }; + rContainer.push_back(xRef); } } else { OSL_ENSURE(false, "Single gradient entry construction without entry (!)"); } - - return xRetval; } void SvgGradientHelper::checkPreconditions() @@ -235,13 +232,13 @@ namespace drawinglayer return fPos; } - Primitive2DContainer SvgGradientHelper::createResult( + void SvgGradientHelper::createResult( + Primitive2DContainer& rContainer, const Primitive2DContainer& rTargetColor, const Primitive2DContainer& rTargetOpacity, const basegfx::B2DHomMatrix& rUnitGradientToObject, bool bInvert) const { - Primitive2DContainer xRetval; const Primitive2DContainer aTargetColorEntries(rTargetColor.maybeInvert(bInvert)); const Primitive2DContainer aTargetOpacityEntries(rTargetOpacity.maybeInvert(bInvert)); @@ -266,14 +263,10 @@ namespace drawinglayer aTargetColorEntries); } - xRefContent = new MaskPrimitive2D( + rContainer.push_back(new MaskPrimitive2D( getPolyPolygon(), - Primitive2DContainer { xRefContent }); - - xRetval = Primitive2DContainer { xRefContent }; + Primitive2DContainer { xRefContent })); } - - return xRetval; } SvgGradientHelper::SvgGradientHelper( @@ -372,10 +365,8 @@ namespace drawinglayer } } - Primitive2DContainer SvgLinearGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void SvgLinearGradientPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DContainer xRetval; - if(!getPreconditionsChecked()) { const_cast< SvgLinearGradientPrimitive2D* >(this)->checkPreconditions(); @@ -384,7 +375,7 @@ namespace drawinglayer if(getSingleEntry()) { // fill with last existing color - xRetval = createSingleGradientEntryFill(); + createSingleGradientEntryFill(rContainer); } else if(getCreatesContent()) { @@ -550,10 +541,8 @@ namespace drawinglayer } } - xRetval = createResult(aTargetColor, aTargetOpacity, aUnitGradientToObject); + createResult(rContainer, aTargetColor, aTargetOpacity, aUnitGradientToObject); } - - return xRetval; } SvgLinearGradientPrimitive2D::SvgLinearGradientPrimitive2D( @@ -715,10 +704,8 @@ namespace drawinglayer } } - Primitive2DContainer SvgRadialGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void SvgRadialGradientPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DContainer xRetval; - if(!getPreconditionsChecked()) { const_cast< SvgRadialGradientPrimitive2D* >(this)->checkPreconditions(); @@ -727,7 +714,7 @@ namespace drawinglayer if(getSingleEntry()) { // fill with last existing color - xRetval = createSingleGradientEntryFill(); + createSingleGradientEntryFill(rContainer); } else if(getCreatesContent()) { @@ -837,10 +824,8 @@ namespace drawinglayer } } - xRetval = createResult(aTargetColor, aTargetOpacity, aUnitGradientToObject, true); + createResult(rContainer, aTargetColor, aTargetOpacity, aUnitGradientToObject, true); } - - return xRetval; } SvgRadialGradientPrimitive2D::SvgRadialGradientPrimitive2D( @@ -919,9 +904,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer SvgLinearAtomPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void SvgLinearAtomPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DContainer xRetval; const double fDelta(getOffsetB() - getOffsetA()); if(!basegfx::fTools::equalZero(fDelta)) @@ -945,21 +929,16 @@ namespace drawinglayer double fUnitScale(0.0); const double fUnitStep(1.0 / nSteps); - // prepare result set (known size) - xRetval.resize(nSteps); - for(sal_uInt32 a(0); a < nSteps; a++, fUnitScale += fUnitStep) { basegfx::B2DPolygon aNew(aPolygon); aNew.transform(basegfx::tools::createTranslateB2DHomMatrix(fDelta * fUnitScale, 0.0)); - xRetval[a] = new PolyPolygonColorPrimitive2D( + rContainer.push_back(new PolyPolygonColorPrimitive2D( basegfx::B2DPolyPolygon(aNew), - basegfx::interpolate(getColorA(), getColorB(), fUnitScale)); + basegfx::interpolate(getColorA(), getColorB(), fUnitScale))); } } - - return xRetval; } SvgLinearAtomPrimitive2D::SvgLinearAtomPrimitive2D( @@ -1006,9 +985,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer SvgRadialAtomPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void SvgRadialAtomPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DContainer xRetval; const double fDeltaScale(getScaleB() - getScaleA()); if(!basegfx::fTools::equalZero(fDeltaScale)) @@ -1023,9 +1001,6 @@ namespace drawinglayer double fUnitScale(0.0); const double fUnitStep(1.0 / nSteps); - // prepare result set (known size) - xRetval.resize(nSteps); - for(sal_uInt32 a(0); a < nSteps; a++, fUnitScale += fUnitStep) { basegfx::B2DHomMatrix aTransform; @@ -1055,13 +1030,11 @@ namespace drawinglayer basegfx::B2DPolygon aNew(basegfx::tools::createPolygonFromUnitCircle()); aNew.transform(aTransform); - xRetval[a] = new PolyPolygonColorPrimitive2D( + rContainer.push_back(new PolyPolygonColorPrimitive2D( basegfx::B2DPolyPolygon(aNew), - basegfx::interpolate(getColorB(), getColorA(), fUnitScale)); + basegfx::interpolate(getColorB(), getColorA(), fUnitScale))); } } - - return xRetval; } SvgRadialAtomPrimitive2D::SvgRadialAtomPrimitive2D( diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index c2222b242372..22efbb16c985 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -154,7 +154,7 @@ namespace drawinglayer // TODO: Handle Font Emphasis Above/Below } - Primitive2DContainer TextDecoratedPortionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void TextDecoratedPortionPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { if(getWordLineMode()) { @@ -166,7 +166,8 @@ namespace drawinglayer if(!aBroken.empty()) { // was indeed split to several words, use as result - return aBroken; + rContainer.insert(rContainer.end(), aBroken.begin(), aBroken.end()); + return; } else { @@ -303,7 +304,7 @@ namespace drawinglayer } } - return aRetval; + rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end()); } TextDecoratedPortionPrimitive2D::TextDecoratedPortionPrimitive2D( diff --git a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx index 2e0838d33c0a..c0965a531444 100644 --- a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx @@ -31,10 +31,8 @@ namespace drawinglayer { static double fDiscreteSize(1.1); - Primitive2DContainer TextEffectPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void TextEffectPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DContainer aRetval; - // get the distance of one discrete units from target display. Use between 1.0 and sqrt(2) to // have good results on rotated objects, too const basegfx::B2DVector aDistance(rViewInformation.getInverseObjectToViewTransformation() * @@ -65,7 +63,6 @@ namespace drawinglayer TextEffectStyle2D::ReliefEmbossedDefault == getTextEffectStyle2D() || TextEffectStyle2D::ReliefEngravedDefault == getTextEffectStyle2D()); basegfx::B2DHomMatrix aTransform(aBackTransform); - aRetval.resize(2); if(bEmbossed) { @@ -91,7 +88,7 @@ namespace drawinglayer getTextContent(), aBColorModifierToGray)); - aRetval[0] = Primitive2DReference( + rContainer.push_back( new TransformPrimitive2D( aTransform, Primitive2DContainer { xModifiedColor })); @@ -101,7 +98,7 @@ namespace drawinglayer new basegfx::BColorModifier_replace( basegfx::BColor(1.0))); - aRetval[1] = Primitive2DReference( + rContainer.push_back( new ModifiedColorPrimitive2D( getTextContent(), aBColorModifierToWhite)); @@ -117,13 +114,13 @@ namespace drawinglayer getTextContent(), aBColorModifierToGray)); - aRetval[0] = Primitive2DReference( + rContainer.push_back( new TransformPrimitive2D( aTransform, Primitive2DContainer { xModifiedColor })); // add original, too - aRetval[1] = Primitive2DReference(new GroupPrimitive2D(getTextContent())); + rContainer.push_back(new GroupPrimitive2D(getTextContent())); } break; @@ -132,45 +129,44 @@ namespace drawinglayer { // create transform primitives in all directions basegfx::B2DHomMatrix aTransform; - aRetval.resize(9); aTransform.set(0, 2, aDistance.getX()); aTransform.set(1, 2, 0.0); - aRetval[0] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, aDiagonalDistance.getX()); aTransform.set(1, 2, aDiagonalDistance.getY()); - aRetval[1] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, 0.0); aTransform.set(1, 2, aDistance.getY()); - aRetval[2] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, -aDiagonalDistance.getX()); aTransform.set(1, 2, aDiagonalDistance.getY()); - aRetval[3] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, -aDistance.getX()); aTransform.set(1, 2, 0.0); - aRetval[4] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, -aDiagonalDistance.getX()); aTransform.set(1, 2, -aDiagonalDistance.getY()); - aRetval[5] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, 0.0); aTransform.set(1, 2, -aDistance.getY()); - aRetval[6] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); aTransform.set(0, 2, aDiagonalDistance.getX()); aTransform.set(1, 2, -aDiagonalDistance.getY()); - aRetval[7] = Primitive2DReference(new TransformPrimitive2D(aTransform, getTextContent())); + rContainer.push_back(new TransformPrimitive2D(aTransform, getTextContent())); // at last, place original over it, but force to white const basegfx::BColorModifierSharedPtr aBColorModifierToWhite( new basegfx::BColorModifier_replace( basegfx::BColor(1.0, 1.0, 1.0))); - aRetval[8] = Primitive2DReference( + rContainer.push_back( new ModifiedColorPrimitive2D( getTextContent(), aBColorModifierToWhite)); @@ -178,8 +174,6 @@ namespace drawinglayer break; } } - - return aRetval; } TextEffectPrimitive2D::TextEffectPrimitive2D( @@ -223,7 +217,7 @@ namespace drawinglayer return aRetval; } - Primitive2DContainer TextEffectPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void TextEffectPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); @@ -243,7 +237,7 @@ namespace drawinglayer } // use parent implementation - return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation); + BufferedDecompositionPrimitive2D::get2DDecomposition(rContainer, rViewInformation); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/textlineprimitive2d.cxx b/drawinglayer/source/primitive2d/textlineprimitive2d.cxx index 0beacdb03b3c..dee8af23ac88 100644 --- a/drawinglayer/source/primitive2d/textlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textlineprimitive2d.cxx @@ -30,10 +30,8 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer TextLinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void TextLinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DContainer xRetval; - if(TEXT_LINE_NONE != getTextLine()) { bool bDoubleLine(false); @@ -218,7 +216,7 @@ namespace drawinglayer } // add primitive - xRetval.push_back(aNewPrimitive); + rContainer.push_back(aNewPrimitive); if(bDoubleLine) { @@ -245,11 +243,9 @@ namespace drawinglayer // add transform primitive const Primitive2DContainer aContent { aNewPrimitive }; - xRetval.push_back( Primitive2DReference(new TransformPrimitive2D(aTransform, aContent))); + rContainer.push_back( new TransformPrimitive2D(aTransform, aContent) ); } } - - return xRetval; } TextLinePrimitive2D::TextLinePrimitive2D( diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index be1c4e70f710..2b3e85c78e52 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -164,7 +164,7 @@ namespace drawinglayer } } - Primitive2DContainer TextSimplePortionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void TextSimplePortionPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { Primitive2DContainer aRetval; @@ -212,7 +212,7 @@ namespace drawinglayer } } - return aRetval; + rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end()); } TextSimplePortionPrimitive2D::TextSimplePortionPrimitive2D( diff --git a/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx b/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx index 300800a5486d..6ff212425852 100644 --- a/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx @@ -64,7 +64,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer TextCharacterStrikeoutPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void TextCharacterStrikeoutPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { // strikeout with character const OUString aSingleCharString(getStrikeoutChar()); @@ -95,7 +95,7 @@ namespace drawinglayer aDXArray[a] = (a + 1) * fStrikeCharWidth; } - Primitive2DReference xReference( + rContainer.push_back( new TextSimplePortionPrimitive2D( getObjectTransformation(), aStrikeoutString, @@ -105,8 +105,6 @@ namespace drawinglayer getFontAttribute(), getLocale(), getFontColor())); - - return Primitive2DContainer { xReference }; } TextCharacterStrikeoutPrimitive2D::TextCharacterStrikeoutPrimitive2D( @@ -148,7 +146,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer TextGeometryStrikeoutPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void TextGeometryStrikeoutPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { OSL_ENSURE(TEXT_STRIKEOUT_SLASH != getTextStrikeout() && TEXT_STRIKEOUT_X != getTextStrikeout(), "Wrong TEXT_STRIKEOUT type; a TextCharacterStrikeoutPrimitive2D should be used (!)"); @@ -231,7 +229,7 @@ namespace drawinglayer xRetval))); } - return xRetval; + rContainer.insert(rContainer.end(), xRetval.begin(), xRetval.end()); } TextGeometryStrikeoutPrimitive2D::TextGeometryStrikeoutPrimitive2D( diff --git a/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx index 02578ac07fb3..cce531f5dac0 100644 --- a/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx @@ -61,12 +61,12 @@ namespace drawinglayer return getChildren().getB2DRange( rViewInformation); } - Primitive2DContainer UnifiedTransparencePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + void UnifiedTransparencePrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const { if(0.0 == getTransparence()) { // no transparence used, so just use the content - return getChildren(); + getChildren(rContainer); } else if(getTransparence() > 0.0 && getTransparence() < 1.0) { @@ -95,13 +95,11 @@ namespace drawinglayer aTransparenceContent[1] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, aGray)); // create sub-transparence group with a gray-colored rectangular fill polygon - const Primitive2DReference xRefB(new TransparencePrimitive2D(getChildren(), aTransparenceContent)); - return Primitive2DContainer { xRefB }; + rContainer.push_back(new TransparencePrimitive2D(getChildren(), aTransparenceContent)); } else { // completely transparent or invalid definition, add nothing - return Primitive2DContainer(); } } diff --git a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx index 87893b1ba209..b5280ad2f31c 100644 --- a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx @@ -32,9 +32,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer WallpaperBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void WallpaperBitmapPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DContainer aRetval; + Primitive2DReference aRetval; if(!getLocalObjectRange().isEmpty() && !getBitmapEx().IsEmpty()) { @@ -58,7 +58,7 @@ namespace drawinglayer getBitmapEx(), aObjectTransform)); - aRetval = Primitive2DContainer { xReference }; + aRetval = xReference; } else { @@ -156,7 +156,7 @@ namespace drawinglayer new BitmapPrimitive2D( getBitmapEx(), aObjectTransform)); - aRetval = Primitive2DContainer { xReference }; + aRetval = xReference; // clip when not completely inside object range bNeedsClipping = !getLocalObjectRange().isInside(aTargetRange); @@ -193,7 +193,7 @@ namespace drawinglayer new drawinglayer::primitive2d::FillGraphicPrimitive2D( aObjectTransform, aFillGraphicAttribute)); - aRetval = Primitive2DContainer { xFillBitmap }; + aRetval = xFillBitmap; // always embed tiled fill to clipping bNeedsClipping = true; @@ -207,14 +207,15 @@ namespace drawinglayer const drawinglayer::primitive2d::Primitive2DReference xClippedFill( new drawinglayer::primitive2d::MaskPrimitive2D( aPolyPolygon, - aRetval)); - aRetval = Primitive2DContainer { xClippedFill }; + { aRetval })); + aRetval = xClippedFill; } } } } - return aRetval; + if (aRetval.is()) + rContainer.push_back(aRetval); } WallpaperBitmapPrimitive2D::WallpaperBitmapPrimitive2D( diff --git a/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx b/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx index 02ffcd60f950..f0e780264b36 100644 --- a/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx @@ -28,7 +28,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DContainer WrongSpellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + void WrongSpellPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const { // ATM this decompose is view-independent, what the original VCL-Display is not. To mimic // the old behaviour here if wanted it is necessary to add get2DDecomposition and implement @@ -66,10 +66,7 @@ namespace drawinglayer const attribute::LineAttribute aLineAttribute(getColor()); // create the waveline primitive - Primitive2DReference xPrimitive(new PolygonWavePrimitive2D(aPolygon, aLineAttribute, fWaveWidth, 0.5 * fWaveWidth)); - Primitive2DContainer xRetval { xPrimitive }; - - return xRetval; + rContainer.push_back(new PolygonWavePrimitive2D(aPolygon, aLineAttribute, fWaveWidth, 0.5 * fWaveWidth)); } WrongSpellPrimitive2D::WrongSpellPrimitive2D( diff --git a/drawinglayer/source/processor2d/baseprocessor2d.cxx b/drawinglayer/source/processor2d/baseprocessor2d.cxx index 59324188bbcb..5f5dcf7e02ca 100644 --- a/drawinglayer/source/processor2d/baseprocessor2d.cxx +++ b/drawinglayer/source/processor2d/baseprocessor2d.cxx @@ -41,6 +41,13 @@ namespace drawinglayer { } + void BaseProcessor2D::process(const primitive2d::BasePrimitive2D& rCandidate) + { + primitive2d::Primitive2DContainer aContainer; + rCandidate.get2DDecomposition(aContainer, getViewInformation2D()); + process(aContainer); + } + void BaseProcessor2D::process(const primitive2d::Primitive2DContainer& rSource) { if(!rSource.empty()) diff --git a/drawinglayer/source/processor2d/contourextractor2d.cxx b/drawinglayer/source/processor2d/contourextractor2d.cxx index 030444f3f698..16228d263e8f 100644 --- a/drawinglayer/source/processor2d/contourextractor2d.cxx +++ b/drawinglayer/source/processor2d/contourextractor2d.cxx @@ -183,7 +183,7 @@ namespace drawinglayer default : { // process recursively - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); break; } } diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index fc20f0a51f9f..214259cb04b0 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -293,7 +293,7 @@ namespace drawinglayer { // if line is mitered, use decomposition since mitered line // geometry may use more space than the geometry grown by half line width - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); } else { @@ -535,7 +535,7 @@ namespace drawinglayer default : { // process recursively - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); break; } diff --git a/drawinglayer/source/processor2d/linegeometryextractor2d.cxx b/drawinglayer/source/processor2d/linegeometryextractor2d.cxx index e1951eb6a2dc..d04c5b42cbe3 100644 --- a/drawinglayer/source/processor2d/linegeometryextractor2d.cxx +++ b/drawinglayer/source/processor2d/linegeometryextractor2d.cxx @@ -53,7 +53,7 @@ namespace drawinglayer // enter a line geometry group (with or without LineEnds) bool bOldState(mbInLineGeometry); mbInLineGeometry = true; - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); mbInLineGeometry = bOldState; break; } @@ -119,7 +119,7 @@ namespace drawinglayer default : { // process recursively - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); break; } } diff --git a/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx b/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx index 830a189f3091..de194d520710 100644 --- a/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx +++ b/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx @@ -55,7 +55,7 @@ namespace drawinglayer // encapsulate with flag and use decomposition mnInText++; - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); mnInText--; break; @@ -73,7 +73,7 @@ namespace drawinglayer // encapsulate with flag and use decomposition mnInText++; - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); mnInText--; break; @@ -211,7 +211,7 @@ namespace drawinglayer default : { // process recursively - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); break; } } diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 19ad8bdb9fb8..885367d3a78f 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -794,7 +794,7 @@ namespace drawinglayer } // process recursively and add MetaFile comment - process(rGraphicPrimitive.get2DDecomposition(getViewInformation2D())); + process(rGraphicPrimitive); if(bUsingPDFExtOutDevData) { @@ -965,7 +965,7 @@ namespace drawinglayer // process recursively if not done yet to export as decomposition (bitmap) if(bDoProcessRecursively) { - process(rControlPrimitive.get2DDecomposition(getViewInformation2D())); + process(rControlPrimitive); } } @@ -1001,7 +1001,8 @@ namespace drawinglayer } // process recursively - const primitive2d::Primitive2DContainer rContent = rFieldPrimitive.get2DDecomposition(getViewInformation2D()); + primitive2d::Primitive2DContainer rContent; + rFieldPrimitive.get2DDecomposition(rContent, getViewInformation2D()); process(rContent); // for the end comment the type is not relevant yet, they are all the same. Just add. @@ -1029,7 +1030,7 @@ namespace drawinglayer const OString aCommentString("XTEXT_EOL"); // process recursively and add MetaFile comment - process(rLinePrimitive.get2DDecomposition(getViewInformation2D())); + process(rLinePrimitive); mpMetaFile->AddAction(new MetaCommentAction(aCommentString)); break; @@ -1042,7 +1043,7 @@ namespace drawinglayer const OString aCommentString("XTEXT_EOC"); // process recursively and add MetaFile comment - process(rBulletPrimitive.get2DDecomposition(getViewInformation2D())); + process(rBulletPrimitive); mpMetaFile->AddAction(new MetaCommentAction(aCommentString)); break; @@ -1059,7 +1060,7 @@ namespace drawinglayer } // process recursively and add MetaFile comment - process(rParagraphPrimitive.get2DDecomposition(getViewInformation2D())); + process(rParagraphPrimitive); mpMetaFile->AddAction(new MetaCommentAction(aCommentString)); if(mpPDFExtOutDevData) @@ -1078,7 +1079,7 @@ namespace drawinglayer // add MetaFile comment, process recursively and add MetaFile comment mpMetaFile->AddAction(new MetaCommentAction(aCommentStringA)); - process(rBlockPrimitive.get2DDecomposition(getViewInformation2D())); + process(rBlockPrimitive); mpMetaFile->AddAction(new MetaCommentAction(aCommentStringB)); break; @@ -1269,7 +1270,7 @@ namespace drawinglayer } else { - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); } impEndSvtGraphicStroke(pSvtGraphicStroke); @@ -1335,7 +1336,7 @@ namespace drawinglayer } // process sub-line geometry (evtl. filled PolyPolygons) - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); if(bDrawmodeChange) { @@ -1434,7 +1435,7 @@ namespace drawinglayer // Do use decomposition; encapsulate with SvtGraphicFill impStartSvtGraphicFill(pSvtGraphicFill); - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); impEndSvtGraphicFill(pSvtGraphicFill); } @@ -1452,7 +1453,7 @@ namespace drawinglayer // the range which defines the hatch is different from the range of the // geometry (used for writer frames). This cannot be done calling vcl, thus use // decomposition here - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); break; } @@ -1577,7 +1578,7 @@ namespace drawinglayer // transfers. One more reason to *change* these to primitives. // BTW: One more example how useful the principles of primitives are; the decomposition // is by definition a simpler, maybe more expensive representation of the same content. - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); break; } @@ -1589,7 +1590,7 @@ namespace drawinglayer // the range which defines the gradient is different from the range of the // geometry (used for writer frames). This cannot be done calling vcl, thus use // decomposition here - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); break; } @@ -1732,7 +1733,7 @@ namespace drawinglayer { // Use new Metafile decomposition. // TODO EMF+ stuffed into METACOMMENT support required - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); } else { @@ -2139,7 +2140,7 @@ namespace drawinglayer default : { // process recursively - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); break; } } diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index c77f6365d7a5..b8e979548049 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -634,12 +634,12 @@ namespace drawinglayer maBColorModifierStack)) { // fallback to decomposition (MetaFile) - process(rWrongSpellPrimitive.get2DDecomposition(getViewInformation2D())); + process(rWrongSpellPrimitive); } } else { - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); } break; } @@ -658,7 +658,7 @@ namespace drawinglayer } else { - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); } // restore DrawMode @@ -681,7 +681,7 @@ namespace drawinglayer } else { - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); } // restore DrawMode @@ -758,7 +758,7 @@ namespace drawinglayer else { // use the primitive decomposition of the metafile - process(rPolygonCandidate.get2DDecomposition(getViewInformation2D())); + process(rPolygonCandidate); } } break; @@ -838,7 +838,7 @@ namespace drawinglayer { // use new Metafile decomposition // TODO EMF+ stuffed into METACOMMENT support required - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); } else { @@ -1031,7 +1031,7 @@ namespace drawinglayer // DBG_UNHANDLED_EXCEPTION(); // process recursively and use the decomposition as Bitmap - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); } break; @@ -1063,7 +1063,7 @@ namespace drawinglayer mnPolygonStrokePrimitive2D++; // with AA there is no need to handle thin lines special - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); // leave PolygonStrokePrimitive2D mnPolygonStrokePrimitive2D--; @@ -1090,7 +1090,7 @@ namespace drawinglayer { // if AA is used (or ignore smoothing is on), there is no need to smooth // hatch painting, use decomposition - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); } else { @@ -1202,7 +1202,7 @@ namespace drawinglayer mpOutputDevice->SetAntialiasing(nAntiAliasing & ~AntialiasingFlags::EnableB2dDraw); // process content recursively - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); // restore OutDev mpOutputDevice->Pop(); @@ -1238,9 +1238,13 @@ namespace drawinglayer if (!tryDrawBorderLinePrimitive2DDirect(rBorder)) { if (rBorder.getStyle() == table::BorderLineStyle::DOUBLE) - process(rBorder.createDecomposition(getViewInformation2D(), true)); + { + primitive2d::Primitive2DContainer aContainer; + rBorder.createDecomposition(aContainer, getViewInformation2D(), true); + process(aContainer); + } else - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); } mpOutputDevice->SetAntialiasing(nAntiAliasing); @@ -1250,7 +1254,7 @@ namespace drawinglayer { SAL_INFO("drawinglayer", "default case for " << drawinglayer::primitive2d::idToString(rCandidate.getPrimitive2DID())); // process recursively - process(rCandidate.get2DDecomposition(getViewInformation2D())); + process(rCandidate); break; } } diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 0d5e2a22fca4..8544f4c44d03 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -314,7 +314,7 @@ namespace drawinglayer if(!bPrimitiveAccepted) { // let break down - process(rTextCandidate.get2DDecomposition(getViewInformation2D())); + process(rTextCandidate); } } @@ -589,7 +589,7 @@ namespace drawinglayer if(!bPrimitiveAccepted) { // do not accept, use decomposition - process(rFillBitmapCandidate.get2DDecomposition(getViewInformation2D())); + process(rFillBitmapCandidate); } } @@ -697,7 +697,7 @@ namespace drawinglayer if(!bDone) { // use default decomposition - process(rPolygonCandidate.get2DDecomposition(getViewInformation2D())); + process(rPolygonCandidate); } } @@ -976,7 +976,7 @@ namespace drawinglayer updateViewInformation(aViewInformation2D); // process decomposed content - process(rPagePreviewCandidate.get2DDecomposition(getViewInformation2D())); + process(rPagePreviewCandidate); // restore transformations updateViewInformation(aLastViewInformation2D); @@ -1247,7 +1247,7 @@ namespace drawinglayer mnPolygonStrokePrimitive2D++; // line width is big enough for standard filled polygon visualisation or zero - process(rPolygonStrokeCandidate.get2DDecomposition(getViewInformation2D())); + process(rPolygonStrokeCandidate); // leave PolygonStrokePrimitive2D mnPolygonStrokePrimitive2D--; @@ -1286,7 +1286,7 @@ namespace drawinglayer { // use the decomposition which will correctly handle the // fallback visualisation using full transformation (e.g. rotation) - process(rEpsPrimitive2D.get2DDecomposition(getViewInformation2D())); + process(rEpsPrimitive2D); } } } |