[Libreoffice-commits] core.git: sd/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Dec 21 13:32:58 UTC 2018
sd/source/ui/func/fumorph.cxx | 22 +++++++++-------------
sd/source/ui/inc/fumorph.hxx | 4 ++--
2 files changed, 11 insertions(+), 15 deletions(-)
New commits:
commit 90368a2e513b92cf5f7916870c7e001b1fb42c7c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Dec 21 14:07:19 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Dec 21 14:32:32 2018 +0100
no need to store B2DPolyPolygon on the heap here
it's a COW type internally, so only one pointer big
Change-Id: I478f5aa6f84c87bedf6f450526e7f8f7c297e7c4
Reviewed-on: https://gerrit.libreoffice.org/65529
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx
index 7604ab825a6e..e4a153d08160 100644
--- a/sd/source/ui/func/fumorph.cxx
+++ b/sd/source/ui/func/fumorph.cxx
@@ -169,10 +169,6 @@ void FuMorph::DoExecute( SfxRequest& )
mpView->BegUndo(aString);
ImpInsertPolygons(aPolyPolyList, pDlg->IsAttributeFade(), pObj1, pObj2);
mpView->EndUndo();
-
- for(basegfx::B2DPolyPolygon * p : aPolyPolyList) {
- delete p;
- }
}
}
SdrObject::Free( pCloneObj1 );
@@ -396,7 +392,7 @@ void FuMorph::ImpInsertPolygons(
for ( size_t i = 0; i < nCount; i++, fFactor += fStep )
{
- const ::basegfx::B2DPolyPolygon& rPolyPoly3D = *rPolyPolyList3D[ i ];
+ const ::basegfx::B2DPolyPolygon& rPolyPoly3D = rPolyPolyList3D[ i ];
SdrPathObj* pNewObj = new SdrPathObj(
mpView->getSdrModelFromSdrView(),
OBJ_POLY,
@@ -446,13 +442,13 @@ void FuMorph::ImpInsertPolygons(
/**
* create single morphed PolyPolygon
*/
-::basegfx::B2DPolyPolygon* FuMorph::ImpCreateMorphedPolygon(
+::basegfx::B2DPolyPolygon FuMorph::ImpCreateMorphedPolygon(
const ::basegfx::B2DPolyPolygon& rPolyPolyStart,
const ::basegfx::B2DPolyPolygon& rPolyPolyEnd,
double fMorphingFactor
)
{
- ::basegfx::B2DPolyPolygon* pNewPolyPolygon = new ::basegfx::B2DPolyPolygon();
+ ::basegfx::B2DPolyPolygon aNewPolyPolygon;
const double fFactor = 1.0 - fMorphingFactor;
for(sal_uInt32 a(0); a < rPolyPolyStart.count(); a++)
@@ -470,10 +466,10 @@ void FuMorph::ImpInsertPolygons(
}
aNewPolygon.setClosed(aPolyStart.isClosed() && aPolyEnd.isClosed());
- pNewPolyPolygon->append(aNewPolygon);
+ aNewPolyPolygon.append(aNewPolygon);
}
- return pNewPolyPolygon;
+ return aNewPolyPolygon;
}
/**
@@ -499,15 +495,15 @@ void FuMorph::ImpMorphPolygons(
for(sal_uInt16 i(0); i < nSteps; i++)
{
fValue += fFactor;
- ::basegfx::B2DPolyPolygon* pNewPolyPoly2D = ImpCreateMorphedPolygon(rPolyPoly1, rPolyPoly2, fValue);
+ ::basegfx::B2DPolyPolygon aNewPolyPoly2D = ImpCreateMorphedPolygon(rPolyPoly1, rPolyPoly2, fValue);
- const ::basegfx::B2DRange aNewPolySize(::basegfx::utils::getRange(*pNewPolyPoly2D));
+ const ::basegfx::B2DRange aNewPolySize(::basegfx::utils::getRange(aNewPolyPoly2D));
const ::basegfx::B2DPoint aNewS(aNewPolySize.getCenter());
const ::basegfx::B2DPoint aRealS(aStartCenter + (aDelta * fValue));
const ::basegfx::B2DPoint aDiff(aRealS - aNewS);
- pNewPolyPoly2D->transform(basegfx::utils::createTranslateB2DHomMatrix(aDiff));
- rPolyPolyList3D.push_back( pNewPolyPoly2D );
+ aNewPolyPoly2D.transform(basegfx::utils::createTranslateB2DHomMatrix(aDiff));
+ rPolyPolyList3D.push_back( std::move(aNewPolyPoly2D) );
}
}
}
diff --git a/sd/source/ui/inc/fumorph.hxx b/sd/source/ui/inc/fumorph.hxx
index ba3a39320f18..434beaae4755 100644
--- a/sd/source/ui/inc/fumorph.hxx
+++ b/sd/source/ui/inc/fumorph.hxx
@@ -41,7 +41,7 @@ public:
virtual void DoExecute( SfxRequest& rReq ) override;
private:
- typedef ::std::vector< ::basegfx::B2DPolyPolygon* > B2DPolyPolygonList_impl;
+ typedef ::std::vector< ::basegfx::B2DPolyPolygon > B2DPolyPolygonList_impl;
FuMorph (
ViewShell* pViewSh,
@@ -57,7 +57,7 @@ private:
const SdrObject* pObj2
);
- static ::basegfx::B2DPolyPolygon* ImpCreateMorphedPolygon(
+ static ::basegfx::B2DPolyPolygon ImpCreateMorphedPolygon(
const ::basegfx::B2DPolyPolygon& rPolyPolyStart,
const ::basegfx::B2DPolyPolygon& rPolyPolyEnd,
double fMorphingFactor
More information about the Libreoffice-commits
mailing list