Kaydet (Commit) 93acb28e authored tarafından Daniel Bankston's avatar Daniel Bankston Kaydeden (comit) Luboš Luňák

fdo#44610 - EasyHack

Since they always return sal_Bool values that are not used by any callers, I changed the Region class methods (both versions of each Union, Intersect, Exclude, XOr) from sal_Bool return type to void return type.
üst b20dd016
...@@ -99,14 +99,14 @@ public: ...@@ -99,14 +99,14 @@ public:
void Move( long nHorzMove, long nVertMove ); void Move( long nHorzMove, long nVertMove );
void Scale( double fScaleX, double fScaleY ); void Scale( double fScaleX, double fScaleY );
sal_Bool Union( const Rectangle& rRegion ); void Union( const Rectangle& rRegion );
sal_Bool Intersect( const Rectangle& rRegion ); void Intersect( const Rectangle& rRegion );
sal_Bool Exclude( const Rectangle& rRegion ); void Exclude( const Rectangle& rRegion );
sal_Bool XOr( const Rectangle& rRegion ); void XOr( const Rectangle& rRegion );
sal_Bool Union( const Region& rRegion ); void Union( const Region& rRegion );
sal_Bool Intersect( const Region& rRegion ); void Intersect( const Region& rRegion );
sal_Bool Exclude( const Region& rRegion ); void Exclude( const Region& rRegion );
sal_Bool XOr( const Region& rRegion ); void XOr( const Region& rRegion );
RegionType GetType() const; RegionType GetType() const;
sal_Bool IsEmpty() const { return GetType() == REGION_EMPTY; }; sal_Bool IsEmpty() const { return GetType() == REGION_EMPTY; };
......
...@@ -1336,13 +1336,13 @@ void Region::Scale( double fScaleX, double fScaleY ) ...@@ -1336,13 +1336,13 @@ void Region::Scale( double fScaleX, double fScaleY )
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
sal_Bool Region::Union( const Rectangle& rRect ) void Region::Union( const Rectangle& rRect )
{ {
DBG_CHKTHIS( Region, ImplDbgTestRegion ); DBG_CHKTHIS( Region, ImplDbgTestRegion );
// is rectangle empty? -> nothing to do // is rectangle empty? -> nothing to do
if ( rRect.IsEmpty() ) if ( rRect.IsEmpty() )
return sal_True; return;
if( HasPolyPolygon() ) if( HasPolyPolygon() )
{ {
...@@ -1353,7 +1353,7 @@ sal_Bool Region::Union( const Rectangle& rRect ) ...@@ -1353,7 +1353,7 @@ sal_Bool Region::Union( const Rectangle& rRect )
if( aThisPolyPoly.count() == 0 ) if( aThisPolyPoly.count() == 0 )
{ {
*this = rRect; *this = rRect;
return true; return;
} }
// get the other B2DPolyPolygon // get the other B2DPolyPolygon
...@@ -1363,7 +1363,7 @@ sal_Bool Region::Union( const Rectangle& rRect ) ...@@ -1363,7 +1363,7 @@ sal_Bool Region::Union( const Rectangle& rRect )
basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationOr( aThisPolyPoly, aOtherPolyPoly ); basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationOr( aThisPolyPoly, aOtherPolyPoly );
*this = Region( aClip ); *this = Region( aClip );
return sal_True; return;
} }
ImplPolyPolyRegionToBandRegion(); ImplPolyPolyRegionToBandRegion();
...@@ -1394,13 +1394,11 @@ sal_Bool Region::Union( const Rectangle& rRect ) ...@@ -1394,13 +1394,11 @@ sal_Bool Region::Union( const Rectangle& rRect )
delete mpImplRegion; delete mpImplRegion;
mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
} }
return sal_True;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
sal_Bool Region::Intersect( const Rectangle& rRect ) void Region::Intersect( const Rectangle& rRect )
{ {
DBG_CHKTHIS( Region, ImplDbgTestRegion ); DBG_CHKTHIS( Region, ImplDbgTestRegion );
...@@ -1416,7 +1414,7 @@ sal_Bool Region::Intersect( const Rectangle& rRect ) ...@@ -1416,7 +1414,7 @@ sal_Bool Region::Intersect( const Rectangle& rRect )
delete mpImplRegion; delete mpImplRegion;
} }
mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
return sal_True; return;
} }
// #103137# Avoid banding for special cases // #103137# Avoid banding for special cases
...@@ -1434,7 +1432,7 @@ sal_Bool Region::Intersect( const Rectangle& rRect ) ...@@ -1434,7 +1432,7 @@ sal_Bool Region::Intersect( const Rectangle& rRect )
// unnecessary banding // unnecessary banding
mpImplRegion->mpPolyPoly->Clip( rRect ); mpImplRegion->mpPolyPoly->Clip( rRect );
return sal_True; return;
} }
else if( mpImplRegion->mpB2DPolyPoly ) else if( mpImplRegion->mpB2DPolyPoly )
{ {
...@@ -1450,14 +1448,14 @@ sal_Bool Region::Intersect( const Rectangle& rRect ) ...@@ -1450,14 +1448,14 @@ sal_Bool Region::Intersect( const Rectangle& rRect )
basegfx::B2DRange( rRect.Left(), rRect.Top(), basegfx::B2DRange( rRect.Left(), rRect.Top(),
rRect.Right(), rRect.Bottom() ), rRect.Right(), rRect.Bottom() ),
true, false ); true, false );
return sal_True; return;
} }
else else
ImplPolyPolyRegionToBandRegion(); ImplPolyPolyRegionToBandRegion();
// is region empty? -> nothing to do! // is region empty? -> nothing to do!
if ( mpImplRegion == &aImplEmptyRegion ) if ( mpImplRegion == &aImplEmptyRegion )
return sal_True; return;
// get justified rectangle // get justified rectangle
long nLeft = Min( rRect.Left(), rRect.Right() ); long nLeft = Min( rRect.Left(), rRect.Right() );
...@@ -1478,7 +1476,7 @@ sal_Bool Region::Intersect( const Rectangle& rRect ) ...@@ -1478,7 +1476,7 @@ sal_Bool Region::Intersect( const Rectangle& rRect )
mpImplRegion->mpFirstBand->Union( nLeft, nRight ); mpImplRegion->mpFirstBand->Union( nLeft, nRight );
mpImplRegion->mnRectCount = 1; mpImplRegion->mnRectCount = 1;
return sal_True; return;
} }
// no own instance data? -> make own copy! // no own instance data? -> make own copy!
...@@ -1521,19 +1519,17 @@ sal_Bool Region::Intersect( const Rectangle& rRect ) ...@@ -1521,19 +1519,17 @@ sal_Bool Region::Intersect( const Rectangle& rRect )
delete mpImplRegion; delete mpImplRegion;
mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
} }
return sal_True;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
sal_Bool Region::Exclude( const Rectangle& rRect ) void Region::Exclude( const Rectangle& rRect )
{ {
DBG_CHKTHIS( Region, ImplDbgTestRegion ); DBG_CHKTHIS( Region, ImplDbgTestRegion );
// is rectangle empty? -> nothing to do // is rectangle empty? -> nothing to do
if ( rRect.IsEmpty() ) if ( rRect.IsEmpty() )
return sal_True; return;
if( HasPolyPolygon() ) if( HasPolyPolygon() )
{ {
...@@ -1542,7 +1538,7 @@ sal_Bool Region::Exclude( const Rectangle& rRect ) ...@@ -1542,7 +1538,7 @@ sal_Bool Region::Exclude( const Rectangle& rRect )
aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly ); aThisPolyPoly = basegfx::tools::prepareForPolygonOperation( aThisPolyPoly );
if( aThisPolyPoly.count() == 0 ) if( aThisPolyPoly.count() == 0 )
return sal_True; return;
// get the other B2DPolyPolygon // get the other B2DPolyPolygon
basegfx::B2DPolygon aRectPoly( basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) ); basegfx::B2DPolygon aRectPoly( basegfx::tools::createPolygonFromRect( basegfx::B2DRectangle( rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() ) ) );
...@@ -1551,14 +1547,14 @@ sal_Bool Region::Exclude( const Rectangle& rRect ) ...@@ -1551,14 +1547,14 @@ sal_Bool Region::Exclude( const Rectangle& rRect )
basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationDiff( aThisPolyPoly, aOtherPolyPoly ); basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationDiff( aThisPolyPoly, aOtherPolyPoly );
*this = Region( aClip ); *this = Region( aClip );
return sal_True; return;
} }
ImplPolyPolyRegionToBandRegion(); ImplPolyPolyRegionToBandRegion();
// no instance data? -> create! // no instance data? -> create!
if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
return sal_True; return;
// no own instance data? -> make own copy! // no own instance data? -> make own copy!
if ( mpImplRegion->mnRefCount > 1 ) if ( mpImplRegion->mnRefCount > 1 )
...@@ -1582,19 +1578,17 @@ sal_Bool Region::Exclude( const Rectangle& rRect ) ...@@ -1582,19 +1578,17 @@ sal_Bool Region::Exclude( const Rectangle& rRect )
delete mpImplRegion; delete mpImplRegion;
mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
} }
return sal_True;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
sal_Bool Region::XOr( const Rectangle& rRect ) void Region::XOr( const Rectangle& rRect )
{ {
DBG_CHKTHIS( Region, ImplDbgTestRegion ); DBG_CHKTHIS( Region, ImplDbgTestRegion );
// is rectangle empty? -> nothing to do // is rectangle empty? -> nothing to do
if ( rRect.IsEmpty() ) if ( rRect.IsEmpty() )
return sal_True; return;
if( HasPolyPolygon() ) if( HasPolyPolygon() )
{ {
...@@ -1605,7 +1599,7 @@ sal_Bool Region::XOr( const Rectangle& rRect ) ...@@ -1605,7 +1599,7 @@ sal_Bool Region::XOr( const Rectangle& rRect )
if( aThisPolyPoly.count() == 0 ) if( aThisPolyPoly.count() == 0 )
{ {
*this = rRect; *this = rRect;
return sal_True; return;
} }
// get the other B2DPolyPolygon // get the other B2DPolyPolygon
...@@ -1615,7 +1609,7 @@ sal_Bool Region::XOr( const Rectangle& rRect ) ...@@ -1615,7 +1609,7 @@ sal_Bool Region::XOr( const Rectangle& rRect )
basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationXor( aThisPolyPoly, aOtherPolyPoly ); basegfx::B2DPolyPolygon aClip = basegfx::tools::solvePolygonOperationXor( aThisPolyPoly, aOtherPolyPoly );
*this = Region( aClip ); *this = Region( aClip );
return sal_True; return;
} }
ImplPolyPolyRegionToBandRegion(); ImplPolyPolyRegionToBandRegion();
...@@ -1646,8 +1640,6 @@ sal_Bool Region::XOr( const Rectangle& rRect ) ...@@ -1646,8 +1640,6 @@ sal_Bool Region::XOr( const Rectangle& rRect )
delete mpImplRegion; delete mpImplRegion;
mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
} }
return sal_True;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -1673,14 +1665,14 @@ void Region::ImplUnionPolyPolygon( const Region& i_rRegion ) ...@@ -1673,14 +1665,14 @@ void Region::ImplUnionPolyPolygon( const Region& i_rRegion )
*this = Region( aClip ); *this = Region( aClip );
} }
sal_Bool Region::Union( const Region& rRegion ) void Region::Union( const Region& rRegion )
{ {
DBG_CHKTHIS( Region, ImplDbgTestRegion ); DBG_CHKTHIS( Region, ImplDbgTestRegion );
if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) if( rRegion.HasPolyPolygon() || HasPolyPolygon() )
{ {
ImplUnionPolyPolygon( rRegion ); ImplUnionPolyPolygon( rRegion );
return sal_True; return;
} }
ImplPolyPolyRegionToBandRegion(); ImplPolyPolyRegionToBandRegion();
...@@ -1688,7 +1680,7 @@ sal_Bool Region::Union( const Region& rRegion ) ...@@ -1688,7 +1680,7 @@ sal_Bool Region::Union( const Region& rRegion )
// is region empty or null? -> nothing to do // is region empty or null? -> nothing to do
if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) ) if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) )
return sal_True; return;
// no instance data? -> create! // no instance data? -> create!
if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
...@@ -1723,8 +1715,6 @@ sal_Bool Region::Union( const Region& rRegion ) ...@@ -1723,8 +1715,6 @@ sal_Bool Region::Union( const Region& rRegion )
delete mpImplRegion; delete mpImplRegion;
mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
} }
return sal_True;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -1745,29 +1735,29 @@ void Region::ImplIntersectWithPolyPolygon( const Region& i_rRegion ) ...@@ -1745,29 +1735,29 @@ void Region::ImplIntersectWithPolyPolygon( const Region& i_rRegion )
*this = Region( aClip ); *this = Region( aClip );
} }
sal_Bool Region::Intersect( const Region& rRegion ) void Region::Intersect( const Region& rRegion )
{ {
DBG_CHKTHIS( Region, ImplDbgTestRegion ); DBG_CHKTHIS( Region, ImplDbgTestRegion );
// same instance data? -> nothing to do! // same instance data? -> nothing to do!
if ( mpImplRegion == rRegion.mpImplRegion ) if ( mpImplRegion == rRegion.mpImplRegion )
return sal_True; return;
if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) if( rRegion.HasPolyPolygon() || HasPolyPolygon() )
{ {
ImplIntersectWithPolyPolygon( rRegion ); ImplIntersectWithPolyPolygon( rRegion );
return sal_True; return;
} }
ImplPolyPolyRegionToBandRegion(); ImplPolyPolyRegionToBandRegion();
((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion(); ((Region*)&rRegion)->ImplPolyPolyRegionToBandRegion();
if ( mpImplRegion == &aImplEmptyRegion ) if ( mpImplRegion == &aImplEmptyRegion )
return sal_True; return;
// is region null? -> nothing to do // is region null? -> nothing to do
if ( rRegion.mpImplRegion == &aImplNullRegion ) if ( rRegion.mpImplRegion == &aImplNullRegion )
return sal_True; return;
// is rectangle empty? -> nothing to do // is rectangle empty? -> nothing to do
if ( rRegion.mpImplRegion == &aImplEmptyRegion ) if ( rRegion.mpImplRegion == &aImplEmptyRegion )
...@@ -1781,7 +1771,7 @@ sal_Bool Region::Intersect( const Region& rRegion ) ...@@ -1781,7 +1771,7 @@ sal_Bool Region::Intersect( const Region& rRegion )
delete mpImplRegion; delete mpImplRegion;
} }
mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
return sal_True; return;
} }
// is own region NULL-region? -> copy data! // is own region NULL-region? -> copy data!
...@@ -1789,7 +1779,7 @@ sal_Bool Region::Intersect( const Region& rRegion ) ...@@ -1789,7 +1779,7 @@ sal_Bool Region::Intersect( const Region& rRegion )
{ {
mpImplRegion = rRegion.mpImplRegion; mpImplRegion = rRegion.mpImplRegion;
rRegion.mpImplRegion->mnRefCount++; rRegion.mpImplRegion->mnRefCount++;
return sal_True; return;
} }
// Wenn wir weniger Rechtecke haben, drehen wir den Intersect-Aufruf um // Wenn wir weniger Rechtecke haben, drehen wir den Intersect-Aufruf um
...@@ -1884,8 +1874,6 @@ sal_Bool Region::Intersect( const Region& rRegion ) ...@@ -1884,8 +1874,6 @@ sal_Bool Region::Intersect( const Region& rRegion )
mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
} }
} }
return sal_True;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -1905,14 +1893,14 @@ void Region::ImplExcludePolyPolygon( const Region& i_rRegion ) ...@@ -1905,14 +1893,14 @@ void Region::ImplExcludePolyPolygon( const Region& i_rRegion )
*this = Region( aClip ); *this = Region( aClip );
} }
sal_Bool Region::Exclude( const Region& rRegion ) void Region::Exclude( const Region& rRegion )
{ {
DBG_CHKTHIS( Region, ImplDbgTestRegion ); DBG_CHKTHIS( Region, ImplDbgTestRegion );
if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) if( rRegion.HasPolyPolygon() || HasPolyPolygon() )
{ {
ImplExcludePolyPolygon( rRegion ); ImplExcludePolyPolygon( rRegion );
return sal_True; return;
} }
ImplPolyPolyRegionToBandRegion(); ImplPolyPolyRegionToBandRegion();
...@@ -1920,11 +1908,11 @@ sal_Bool Region::Exclude( const Region& rRegion ) ...@@ -1920,11 +1908,11 @@ sal_Bool Region::Exclude( const Region& rRegion )
// is region empty or null? -> nothing to do // is region empty or null? -> nothing to do
if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) ) if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) )
return sal_True; return;
// no instance data? -> nothing to do // no instance data? -> nothing to do
if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
return sal_True; return;
// no own instance data? -> make own copy! // no own instance data? -> make own copy!
if ( mpImplRegion->mnRefCount > 1 ) if ( mpImplRegion->mnRefCount > 1 )
...@@ -1958,8 +1946,6 @@ sal_Bool Region::Exclude( const Region& rRegion ) ...@@ -1958,8 +1946,6 @@ sal_Bool Region::Exclude( const Region& rRegion )
pBand = pBand->mpNextBand; pBand = pBand->mpNextBand;
} }
return sal_True;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -1982,14 +1968,14 @@ void Region::ImplXOrPolyPolygon( const Region& i_rRegion ) ...@@ -1982,14 +1968,14 @@ void Region::ImplXOrPolyPolygon( const Region& i_rRegion )
*this = Region( aClip ); *this = Region( aClip );
} }
sal_Bool Region::XOr( const Region& rRegion ) void Region::XOr( const Region& rRegion )
{ {
DBG_CHKTHIS( Region, ImplDbgTestRegion ); DBG_CHKTHIS( Region, ImplDbgTestRegion );
if( rRegion.HasPolyPolygon() || HasPolyPolygon() ) if( rRegion.HasPolyPolygon() || HasPolyPolygon() )
{ {
ImplXOrPolyPolygon( rRegion ); ImplXOrPolyPolygon( rRegion );
return sal_True; return;
} }
ImplPolyPolyRegionToBandRegion(); ImplPolyPolyRegionToBandRegion();
...@@ -1997,13 +1983,13 @@ sal_Bool Region::XOr( const Region& rRegion ) ...@@ -1997,13 +1983,13 @@ sal_Bool Region::XOr( const Region& rRegion )
// is region empty or null? -> nothing to do // is region empty or null? -> nothing to do
if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) ) if ( (rRegion.mpImplRegion == &aImplEmptyRegion) || (rRegion.mpImplRegion == &aImplNullRegion) )
return sal_True; return;
// no own instance data? -> XOr = copy // no own instance data? -> XOr = copy
if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) ) if ( (mpImplRegion == &aImplEmptyRegion) || (mpImplRegion == &aImplNullRegion) )
{ {
*this = rRegion; *this = rRegion;
return sal_True; return;
} }
// no own instance data? -> make own copy! // no own instance data? -> make own copy!
...@@ -2035,8 +2021,6 @@ sal_Bool Region::XOr( const Region& rRegion ) ...@@ -2035,8 +2021,6 @@ sal_Bool Region::XOr( const Region& rRegion )
delete mpImplRegion; delete mpImplRegion;
mpImplRegion = (ImplRegion*)(&aImplEmptyRegion); mpImplRegion = (ImplRegion*)(&aImplEmptyRegion);
} }
return sal_True;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment