summaryrefslogtreecommitdiff
path: root/basegfx/source
diff options
context:
space:
mode:
authorhdu <duerr@sun.com>2009-10-22 16:54:19 +0200
committerhdu <duerr@sun.com>2009-10-22 16:54:19 +0200
commit406092f60abbb258bbd1fc6f2d09e7a669af943b (patch)
tree160325a883854cd03096c9806a70e561c8a8ad08 /basegfx/source
parente4a2ffe6631406782a36789e21ac3cc5ab4c54d3 (diff)
#i106127# perf: using vector.push_back() instead of the generic vector.insertAtWithCount() is worth it when it gets called a gazillion times
Diffstat (limited to 'basegfx/source')
-rw-r--r--basegfx/source/polygon/b2dpolygon.cxx35
1 files changed, 34 insertions, 1 deletions
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx
index d44599e0f49e..48d00ddcec7d 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -7,7 +7,6 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: b2dpolygon.cxx,v $
- * $Revision: 1.22 $
*
* This file is part of OpenOffice.org.
*
@@ -128,6 +127,11 @@ public:
maVector.reserve(nCount);
}
+ void append(const CoordinateData2D& rValue)
+ {
+ maVector.push_back(rValue);
+ }
+
void insert(sal_uInt32 nIndex, const CoordinateData2D& rValue, sal_uInt32 nCount)
{
if(nCount)
@@ -385,6 +389,17 @@ public:
}
}
+ void append(const ControlVectorPair2D& rValue)
+ {
+ maVector.push_back(rValue);
+
+ if(!rValue.getPrevVector().equalZero())
+ mnUsedVectors += 1;
+
+ if(!rValue.getNextVector().equalZero())
+ mnUsedVectors += 1;
+ }
+
void insert(sal_uInt32 nIndex, const ControlVectorPair2D& rValue, sal_uInt32 nCount)
{
if(nCount)
@@ -751,6 +766,19 @@ public:
maPoints.reserve(nCount);
}
+ void append(const basegfx::B2DPoint& rPoint)
+ {
+ mpBufferedData.reset(); // TODO: is this needed?
+ const CoordinateData2D aCoordinate(rPoint);
+ maPoints.append(aCoordinate);
+
+ if(mpControlVector)
+ {
+ const ControlVectorPair2D aVectorPair;
+ mpControlVector->append(aVectorPair);
+ }
+ }
+
void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 nCount)
{
if(nCount)
@@ -1223,6 +1251,11 @@ namespace basegfx
}
}
+ void B2DPolygon::append(const B2DPoint& rPoint)
+ {
+ mpPolygon->append(rPoint);
+ }
+
B2DPoint B2DPolygon::getPrevControlPoint(sal_uInt32 nIndex) const
{
OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)");