From 7b7c3b6e1102e7f8856f047fe475ddbc53438f4e Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Tue, 13 Dec 2011 19:18:39 +0100 Subject: More efficient insertion of B3DPolygons * some cleanup - removed ugly-as-hell exposure of only parts of the internal data struct on B2DPolygon (and reworked the only client of that code) * added stl-style begin/end to B3DPolyPolygon as well, mirroring B2DPolyPolygon, plus adapting the insert() func to make use of that (avoiding loads of temporaries) --- basegfx/test/boxclipper.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'basegfx/test') diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx index 05cbb7bc252f..20a17b031fe7 100644 --- a/basegfx/test/boxclipper.cxx +++ b/basegfx/test/boxclipper.cxx @@ -206,18 +206,25 @@ public: aTmp.flip(); aTmp=tools::removeNeutralPoints(aTmp); + std::vector aTmp2(aTmp.count()); + for(sal_uInt32 j=0; j::iterator pSmallest=aTmp2.end(); + for(std::vector::iterator pCurr=aTmp2.begin(); pCurr!=aTmp2.end(); ++pCurr) { - if( ! pSmallest || compare(*pCurr, *pSmallest) ) + if( pSmallest == aTmp2.end() || compare(*pCurr, *pSmallest) ) { pSmallest=pCurr; } } - if( pSmallest ) - std::rotate(aTmp.begin(),pSmallest,aTmp.end()); + if( pSmallest != aTmp2.end() ) + std::rotate(aTmp2.begin(),pSmallest,aTmp2.end()); + + aTmp.clear(); + for(std::vector::iterator pCurr=aTmp2.begin(); pCurr!=aTmp2.end(); ++pCurr) + aTmp.append(*pCurr); aRes.append(aTmp); } -- cgit