diff options
Diffstat (limited to 'tools/source/generic/poly.cxx')
-rw-r--r-- | tools/source/generic/poly.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 3c78b5a04bc8..b88c411a927b 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -100,6 +100,24 @@ ImplPolygon::ImplPolygon( sal_uInt16 nInitSize, const Point* pInitAry, const Pol mnPoints = nInitSize; } +ImplPolygon::ImplPolygon( std::vector< std::pair<Point, PolyFlags> > const & rPointsAndFlags ) +{ + auto nInitSize = rPointsAndFlags.size(); + if ( nInitSize ) + { + mxPointAry.reset(new Point[nInitSize]); + mxFlagAry.reset(new PolyFlags[nInitSize]); + int i = 0; + for (auto const & rPair : rPointsAndFlags) { + mxPointAry[i] = rPair.first; + mxFlagAry[i] = rPair.second; + ++i; + } + } + + mnPoints = nInitSize; +} + ImplPolygon::ImplPolygon( const tools::Rectangle& rRect ) { if ( !rRect.IsEmpty() ) @@ -868,6 +886,10 @@ Polygon::Polygon( sal_uInt16 nPoints, const Point* pPtAry, const PolyFlags* pFla { } +Polygon::Polygon( std::vector< std::pair<Point, PolyFlags> > const & rPointsAndFlags ) : mpImplPolygon(ImplPolygon(rPointsAndFlags)) +{ +} + Polygon::Polygon( const tools::Polygon& rPoly ) : mpImplPolygon(rPoly.mpImplPolygon) { } |