From e35ef2502974c74f85c89a9dbc93b1137defcf48 Mon Sep 17 00:00:00 2001 From: Matteo Casalin Date: Thu, 5 Nov 2015 10:32:19 +0100 Subject: [PATCH] class PolyOptimizeData is never instantiated Change-Id: I136b3b1d572e4401d89d50f543150d71dbe44d16 --- include/tools/poly.hxx | 21 ++------------------- tools/source/generic/poly.cxx | 11 +++-------- tools/source/generic/poly2.cxx | 8 ++++---- 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx index 99481a7ec8bf..33cfb5da9528 100644 --- a/include/tools/poly.hxx +++ b/include/tools/poly.hxx @@ -57,23 +57,6 @@ enum PolyFlags POLY_SYMMTR }; -class SAL_WARN_UNUSED PolyOptimizeData -{ -private: - - enum DataType { DATA_NONE = 0, DATA_ABSOLUT = 1, DATA_PERCENT = 2 }; - DataType eType; - union { sal_uIntPtr mnAbsolut; sal_uInt16 mnPercent; }; - -public: - PolyOptimizeData() : eType( DATA_NONE ) {} - PolyOptimizeData( sal_uIntPtr nAbsolut ) : eType( DATA_ABSOLUT ), mnAbsolut( nAbsolut ) {} - PolyOptimizeData( sal_uInt16 nPercent ) : eType( DATA_PERCENT ), mnPercent( nPercent ) {} - - sal_uIntPtr GetAbsValue() const { (void) eType; DBG_ASSERT( eType == DATA_ABSOLUT, "Wrong data type" ); return mnAbsolut; } - sal_uInt16 GetPercentValue() const { (void) eType; DBG_ASSERT( eType == DATA_PERCENT, "Wrong data type" ); return mnPercent; } -}; - class SvStream; class ImplPolygon; class ImplPolyPolygon; @@ -141,7 +124,7 @@ public: bool IsRightOrientated() const; double CalcDistance( sal_uInt16 nPt1, sal_uInt16 nPt2 ); void Clip( const Rectangle& rRect, bool bPolygon = true ); - void Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimizeData* pData = NULL ); + void Optimize( PolyOptimizeFlags nOptimizeFlags ); /** Adaptive subdivision of polygons with curves @@ -227,7 +210,7 @@ public: sal_uInt16 Count() const; Rectangle GetBoundRect() const; void Clip( const Rectangle& rRect ); - void Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimizeData* pData = NULL ); + void Optimize( PolyOptimizeFlags nOptimizeFlags ); /** Adaptive subdivision of polygons with curves diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index f53dbf19c36c..539178c15b5b 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -904,7 +904,7 @@ double Polygon::CalcDistance( sal_uInt16 nP1, sal_uInt16 nP2 ) return sqrt( fDx * fDx + fDy * fDy ); } -void Polygon::Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimizeData* pData ) +void Polygon::Optimize( PolyOptimizeFlags nOptimizeFlags ) { DBG_ASSERT( !mpImplPolygon->mpFlagAry, "Optimizing could fail with beziers!" ); @@ -916,7 +916,7 @@ void Polygon::Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimizeData { const Rectangle aBound( GetBoundRect() ); const double fArea = ( aBound.GetWidth() + aBound.GetHeight() ) * 0.5; - const sal_uInt16 nPercent = pData ? pData->GetPercentValue() : 50; + const sal_uInt16 nPercent = 50; Optimize( PolyOptimizeFlags::NO_SAME ); ImplReduceEdges( *this, fArea, nPercent ); @@ -925,12 +925,7 @@ void Polygon::Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimizeData { tools::Polygon aNewPoly; const Point& rFirst = mpImplPolygon->mpPointAry[ 0 ]; - sal_uIntPtr nReduce; - - if( nOptimizeFlags & ( PolyOptimizeFlags::REDUCE ) ) - nReduce = pData ? pData->GetAbsValue() : 4UL; - else - nReduce = 0UL; + const sal_uIntPtr nReduce = ( nOptimizeFlags & PolyOptimizeFlags::REDUCE ) ? 4 : 0; while( nSize && ( mpImplPolygon->mpPointAry[ nSize - 1 ] == rFirst ) ) nSize--; diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index 7005a56a90e2..7622c6f1b2a9 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -224,7 +224,7 @@ void PolyPolygon::Clear() } } -void PolyPolygon::Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimizeData* pData ) +void PolyPolygon::Optimize( PolyOptimizeFlags nOptimizeFlags ) { if(bool(nOptimizeFlags) && Count()) { @@ -245,7 +245,7 @@ void PolyPolygon::Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimize tools::PolyPolygon aPolyPoly; AdaptiveSubdivide(aPolyPoly); - aPolyPoly.Optimize(nOptimizeFlags, pData); + aPolyPoly.Optimize(nOptimizeFlags); *this = aPolyPoly; } else @@ -259,7 +259,7 @@ void PolyPolygon::Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimize const Rectangle aBound( GetBoundRect() ); fArea = ( aBound.GetWidth() + aBound.GetHeight() ) * 0.5; - nPercent = pData ? pData->GetPercentValue() : 50; + nPercent = 50; nOptimizeFlags &= ~PolyOptimizeFlags::EDGES; } @@ -280,7 +280,7 @@ void PolyPolygon::Optimize( PolyOptimizeFlags nOptimizeFlags, const PolyOptimize } if( bool(nOptimizeFlags) ) - mpImplPolyPolygon->mpPolyAry[ i ]->Optimize( nOptimizeFlags, pData ); + mpImplPolyPolygon->mpPolyAry[ i ]->Optimize( nOptimizeFlags ); } } }