class PolyOptimizeData is never instantiated

Change-Id: I136b3b1d572e4401d89d50f543150d71dbe44d16
This commit is contained in:
Matteo Casalin 2015-11-05 10:32:19 +01:00
parent e8d81c0240
commit e35ef25029
3 changed files with 9 additions and 31 deletions

View File

@ -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

View File

@ -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--;

View File

@ -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 );
}
}
}