diff options
author | Noel Grandin <noel@peralex.com> | 2015-01-04 19:34:19 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-01-09 09:08:35 +0200 |
commit | 278b400511a76a9be5e0afc0377a9c69823cc230 (patch) | |
tree | faf2573bf0f0e57817dcd8cac9f9b36989402710 /tools | |
parent | 5c5edaef89e953d260501678c3d62c47ad9763ac (diff) |
fdo#84938: convert POLY_OPTIMIZE_ #defines to 'enum class'
Change-Id: I163bd3f521473c5357c23c3ce4978f984be7b6fe
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/generic/poly.cxx | 16 | ||||
-rw-r--r-- | tools/source/generic/poly2.cxx | 12 |
2 files changed, 14 insertions, 14 deletions
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index eb3859a1bddd..e949835f8b56 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -697,30 +697,30 @@ double Polygon::CalcDistance( sal_uInt16 nP1, sal_uInt16 nP2 ) return sqrt( fDx * fDx + fDy * fDy ); } -void Polygon::Optimize( sal_uIntPtr nOptimizeFlags, const PolyOptimizeData* pData ) +void Polygon::Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimizeData* pData ) { DBG_ASSERT( !mpImplPolygon->mpFlagAry, "Optimizing could fail with beziers!" ); sal_uInt16 nSize = mpImplPolygon->mnPoints; - if( nOptimizeFlags && nSize ) + if( bool(nOptimizeFlags) && nSize ) { - if( nOptimizeFlags & POLY_OPTIMIZE_EDGES ) + if( nOptimizeFlags & PolyOptimizeFlags::EDGES ) { const Rectangle aBound( GetBoundRect() ); const double fArea = ( aBound.GetWidth() + aBound.GetHeight() ) * 0.5; const sal_uInt16 nPercent = pData ? pData->GetPercentValue() : 50; - Optimize( POLY_OPTIMIZE_NO_SAME ); + Optimize( PolyOptimizeFlags::NO_SAME ); ImplReduceEdges( *this, fArea, nPercent ); } - else if( nOptimizeFlags & ( POLY_OPTIMIZE_REDUCE | POLY_OPTIMIZE_NO_SAME ) ) + else if( nOptimizeFlags & ( PolyOptimizeFlags::REDUCE | PolyOptimizeFlags::NO_SAME ) ) { Polygon aNewPoly; const Point& rFirst = mpImplPolygon->mpPointAry[ 0 ]; sal_uIntPtr nReduce; - if( nOptimizeFlags & ( POLY_OPTIMIZE_REDUCE ) ) + if( nOptimizeFlags & ( PolyOptimizeFlags::REDUCE ) ) nReduce = pData ? pData->GetAbsValue() : 4UL; else nReduce = 0UL; @@ -757,13 +757,13 @@ void Polygon::Optimize( sal_uIntPtr nOptimizeFlags, const PolyOptimizeData* pDat if( nSize > 1 ) { - if( ( nOptimizeFlags & POLY_OPTIMIZE_CLOSE ) && + if( ( nOptimizeFlags & PolyOptimizeFlags::CLOSE ) && ( mpImplPolygon->mpPointAry[ 0 ] != mpImplPolygon->mpPointAry[ nSize - 1 ] ) ) { SetSize( mpImplPolygon->mnPoints + 1 ); mpImplPolygon->mpPointAry[ mpImplPolygon->mnPoints - 1 ] = mpImplPolygon->mpPointAry[ 0 ]; } - else if( ( nOptimizeFlags & POLY_OPTIMIZE_OPEN ) && + else if( ( nOptimizeFlags & PolyOptimizeFlags::OPEN ) && ( mpImplPolygon->mpPointAry[ 0 ] == mpImplPolygon->mpPointAry[ nSize - 1 ] ) ) { const Point& rFirst = mpImplPolygon->mpPointAry[ 0 ]; diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index eec33a2624b0..9ed24b1b7484 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -223,9 +223,9 @@ void PolyPolygon::Clear() } } -void PolyPolygon::Optimize( sal_uIntPtr nOptimizeFlags, const PolyOptimizeData* pData ) +void PolyPolygon::Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimizeData* pData ) { - if(nOptimizeFlags && Count()) + if(bool(nOptimizeFlags) && Count()) { // #115630# ImplDrawHatch does not work with beziers included in the polypolygon, take care of that bool bIsCurve(false); @@ -250,7 +250,7 @@ void PolyPolygon::Optimize( sal_uIntPtr nOptimizeFlags, const PolyOptimizeData* else { double fArea; - const bool bEdges = ( nOptimizeFlags & POLY_OPTIMIZE_EDGES ) == POLY_OPTIMIZE_EDGES; + const bool bEdges = ( nOptimizeFlags & PolyOptimizeFlags::EDGES ) == PolyOptimizeFlags::EDGES; sal_uInt16 nPercent = 0; if( bEdges ) @@ -259,7 +259,7 @@ void PolyPolygon::Optimize( sal_uIntPtr nOptimizeFlags, const PolyOptimizeData* fArea = ( aBound.GetWidth() + aBound.GetHeight() ) * 0.5; nPercent = pData ? pData->GetPercentValue() : 50; - nOptimizeFlags &= ~POLY_OPTIMIZE_EDGES; + nOptimizeFlags &= ~PolyOptimizeFlags::EDGES; } // watch for ref counter @@ -274,11 +274,11 @@ void PolyPolygon::Optimize( sal_uIntPtr nOptimizeFlags, const PolyOptimizeData* { if( bEdges ) { - mpImplPolyPolygon->mpPolyAry[ i ]->Optimize( POLY_OPTIMIZE_NO_SAME ); + mpImplPolyPolygon->mpPolyAry[ i ]->Optimize( PolyOptimizeFlags::NO_SAME ); Polygon::ImplReduceEdges( *( mpImplPolyPolygon->mpPolyAry[ i ] ), fArea, nPercent ); } - if( nOptimizeFlags ) + if( bool(nOptimizeFlags) ) mpImplPolyPolygon->mpPolyAry[ i ]->Optimize( nOptimizeFlags, pData ); } } |