summaryrefslogtreecommitdiffstats
path: root/basegfx/source/tools/unopolypolygon.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basegfx/source/tools/unopolypolygon.cxx')
-rw-r--r--basegfx/source/tools/unopolypolygon.cxx26
1 files changed, 11 insertions, 15 deletions
diff --git a/basegfx/source/tools/unopolypolygon.cxx b/basegfx/source/tools/unopolypolygon.cxx
index 48b3372d5526..323e06a96f18 100644
--- a/basegfx/source/tools/unopolypolygon.cxx
+++ b/basegfx/source/tools/unopolypolygon.cxx
@@ -28,17 +28,16 @@
#include <basegfx/utils/unopolypolygon.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <utility>
using namespace ::com::sun::star;
namespace basegfx::unotools
{
- UnoPolyPolygon::UnoPolyPolygon( const B2DPolyPolygon& rPolyPoly ) :
- maPolyPoly( rPolyPoly ),
+ UnoPolyPolygon::UnoPolyPolygon( B2DPolyPolygon aPolyPoly ) :
+ maPolyPoly(std::move( aPolyPoly )),
meFillRule( rendering::FillRule_EVEN_ODD )
{
- // or else races will haunt us.
- maPolyPoly.makeUnique();
}
void SAL_CALL UnoPolyPolygon::addPolyPolygon(
@@ -98,7 +97,7 @@ namespace basegfx::unotools
throw lang::IllegalArgumentException(
"UnoPolyPolygon::addPolyPolygon(): Invalid input "
"poly-polygon, cannot retrieve vertex data",
- static_cast<cppu::OWeakObject*>(this), 1);
+ getXWeak(), 1);
aSrcPoly = unotools::polyPolygonFromPoint2DSequenceSequence(
xLinePoly->getPoints( 0,
@@ -229,7 +228,7 @@ namespace basegfx::unotools
const B2DPolygon& rPoly( maPolyPoly.getB2DPolygon( nPolygonIndex ) );
- if( nPointIndex < 0 || nPointIndex >= static_cast<sal_Int32>(rPoly.count()) )
+ if( nPointIndex < 0 || o3tl::make_unsigned(nPointIndex) >= rPoly.count() )
throw lang::IndexOutOfBoundsException();
return unotools::point2DFromB2DPoint( rPoly.getB2DPoint( nPointIndex ) );
@@ -246,7 +245,7 @@ namespace basegfx::unotools
B2DPolygon aPoly( maPolyPoly.getB2DPolygon( nPolygonIndex ) );
- if( nPointIndex < 0 || nPointIndex >= static_cast<sal_Int32>(aPoly.count()) )
+ if( nPointIndex < 0 || o3tl::make_unsigned(nPointIndex) >= aPoly.count() )
throw lang::IndexOutOfBoundsException();
aPoly.setB2DPoint( nPointIndex,
@@ -297,7 +296,7 @@ namespace basegfx::unotools
const B2DPolygon& rPoly( maPolyPoly.getB2DPolygon( nPolygonIndex ) );
const sal_uInt32 nPointCount(rPoly.count());
- if( nPointIndex < 0 || nPointIndex >= static_cast<sal_Int32>(nPointCount) )
+ if( nPointIndex < 0 || o3tl::make_unsigned(nPointIndex) >= nPointCount )
throw lang::IndexOutOfBoundsException();
const B2DPoint& rPt( rPoly.getB2DPoint( nPointIndex ) );
@@ -323,7 +322,7 @@ namespace basegfx::unotools
B2DPolygon aPoly( maPolyPoly.getB2DPolygon( nPolygonIndex ) );
const sal_uInt32 nPointCount(aPoly.count());
- if( nPointIndex < 0 || nPointIndex >= static_cast<sal_Int32>(nPointCount) )
+ if( nPointIndex < 0 || o3tl::make_unsigned(nPointIndex) >= nPointCount )
throw lang::IndexOutOfBoundsException();
aPoly.setB2DPoint( nPointIndex,
@@ -422,7 +421,7 @@ namespace basegfx::unotools
OUString SAL_CALL UnoPolyPolygon::getImplementationName()
{
- return "gfx::internal::UnoPolyPolygon";
+ return u"gfx::internal::UnoPolyPolygon"_ustr;
}
sal_Bool SAL_CALL UnoPolyPolygon::supportsService( const OUString& ServiceName )
@@ -432,17 +431,14 @@ namespace basegfx::unotools
uno::Sequence< OUString > SAL_CALL UnoPolyPolygon::getSupportedServiceNames()
{
- return { "com.sun.star.rendering.PolyPolygon2D" };
+ return { u"com.sun.star.rendering.PolyPolygon2D"_ustr };
}
B2DPolyPolygon UnoPolyPolygon::getPolyPolygon() const
{
std::unique_lock const guard( m_aMutex );
- // detach result from us
- B2DPolyPolygon aRet( maPolyPoly );
- aRet.makeUnique();
- return aRet;
+ return maPolyPoly;
}
}