summaryrefslogtreecommitdiff
path: root/basegfx/source/polygon
diff options
context:
space:
mode:
authorthb <thb@openoffice.org>2009-10-16 00:53:07 +0200
committerthb <thb@openoffice.org>2009-10-16 00:53:07 +0200
commit8454c5ef5057d0d24e52fb9ed10483b598da98b0 (patch)
treee8554d2050c491a98a731cc354a22ea9e3d08c37 /basegfx/source/polygon
parent44dfc8de1a248a4e62c3229adb7acf91f968d66e (diff)
#i105939# Adds special box clipping support to basegfx
Diffstat (limited to 'basegfx/source/polygon')
-rw-r--r--basegfx/source/polygon/b2dpolygon.cxx98
-rw-r--r--basegfx/source/polygon/b2dpolypolygon.cxx40
2 files changed, 113 insertions, 25 deletions
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx
index 467a4b90f516..ccf45d31cbbc 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -44,38 +44,24 @@
//////////////////////////////////////////////////////////////////////////////
-class CoordinateData2D
+struct CoordinateData2D : public basegfx::B2DPoint
{
- basegfx::B2DPoint maPoint;
-
public:
- CoordinateData2D()
- : maPoint()
- {}
+ CoordinateData2D() {}
explicit CoordinateData2D(const basegfx::B2DPoint& rData)
- : maPoint(rData)
+ : B2DPoint(rData)
{}
- const basegfx::B2DPoint& getCoordinate() const
- {
- return maPoint;
- }
-
- void setCoordinate(const basegfx::B2DPoint& rValue)
- {
- if(rValue != maPoint)
- maPoint = rValue;
- }
-
- bool operator==(const CoordinateData2D& rData ) const
+ CoordinateData2D& operator=(const basegfx::B2DPoint& rData)
{
- return (maPoint == rData.getCoordinate());
+ B2DPoint::operator=(rData);
+ return *this;
}
void transform(const basegfx::B2DHomMatrix& rMatrix)
{
- maPoint *= rMatrix;
+ *this *= rMatrix;
}
};
@@ -115,12 +101,12 @@ public:
const basegfx::B2DPoint& getCoordinate(sal_uInt32 nIndex) const
{
- return maVector[nIndex].getCoordinate();
+ return maVector[nIndex];
}
void setCoordinate(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue)
{
- maVector[nIndex].setCoordinate(rValue);
+ maVector[nIndex] = rValue;
}
void insert(sal_uInt32 nIndex, const CoordinateData2D& rValue, sal_uInt32 nCount)
@@ -221,6 +207,26 @@ public:
aStart->transform(rMatrix);
}
}
+
+ const basegfx::B2DPoint* begin() const
+ {
+ return &maVector.front();
+ }
+
+ const basegfx::B2DPoint* end() const
+ {
+ return &maVector[maVector.size()];
+ }
+
+ basegfx::B2DPoint* begin()
+ {
+ return &maVector.front();
+ }
+
+ basegfx::B2DPoint* end()
+ {
+ return &maVector[maVector.size()];
+ }
};
//////////////////////////////////////////////////////////////////////////////
@@ -1113,6 +1119,28 @@ public:
maPoints.transform(rMatrix);
}
}
+
+ const basegfx::B2DPoint* begin() const
+ {
+ return maPoints.begin();
+ }
+
+ const basegfx::B2DPoint* end() const
+ {
+ return maPoints.end();
+ }
+
+ basegfx::B2DPoint* begin()
+ {
+ mpBufferedData.reset();
+ return maPoints.begin();
+ }
+
+ basegfx::B2DPoint* end()
+ {
+ mpBufferedData.reset();
+ return maPoints.end();
+ }
};
//////////////////////////////////////////////////////////////////////////////
@@ -1173,7 +1201,7 @@ namespace basegfx
return mpPolygon->count();
}
- B2DPoint B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const
+ const B2DPoint& B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const
{
OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)");
@@ -1432,7 +1460,7 @@ namespace basegfx
return mpPolygon->getDefaultAdaptiveSubdivision(*this);
}
- B2DRange B2DPolygon::getB2DRange() const
+ const B2DRange& B2DPolygon::getB2DRange() const
{
return mpPolygon->getB2DRange(*this);
}
@@ -1540,6 +1568,26 @@ namespace basegfx
mpPolygon->transform(rMatrix);
}
}
+
+ const B2DPoint* B2DPolygon::begin() const
+ {
+ return mpPolygon->begin();
+ }
+
+ const B2DPoint* B2DPolygon::end() const
+ {
+ return mpPolygon->end();
+ }
+
+ B2DPoint* B2DPolygon::begin()
+ {
+ return mpPolygon->begin();
+ }
+
+ B2DPoint* B2DPolygon::end()
+ {
+ return mpPolygon->end();
+ }
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index 6467e7120c03..af63bbccf8d4 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -166,6 +166,26 @@ public:
maPolygons.end(),
std::mem_fun_ref( &basegfx::B2DPolygon::makeUnique ));
}
+
+ const basegfx::B2DPolygon* begin() const
+ {
+ return &maPolygons.front();
+ }
+
+ const basegfx::B2DPolygon* end() const
+ {
+ return &maPolygons[maPolygons.size()];
+ }
+
+ basegfx::B2DPolygon* begin()
+ {
+ return &maPolygons.front();
+ }
+
+ basegfx::B2DPolygon* end()
+ {
+ return &maPolygons[maPolygons.size()];
+ }
};
//////////////////////////////////////////////////////////////////////////////
@@ -378,6 +398,26 @@ namespace basegfx
mpPolyPolygon->transform(rMatrix);
}
}
+
+ const B2DPolygon* B2DPolyPolygon::begin() const
+ {
+ return mpPolyPolygon->begin();
+ }
+
+ const B2DPolygon* B2DPolyPolygon::end() const
+ {
+ return mpPolyPolygon->end();
+ }
+
+ B2DPolygon* B2DPolyPolygon::begin()
+ {
+ return mpPolyPolygon->begin();
+ }
+
+ B2DPolygon* B2DPolyPolygon::end()
+ {
+ return mpPolyPolygon->end();
+ }
} // end of namespace basegfx
// eof