Kaydet (Commit) 3f89eccf authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Do not cripple intermediate values to sal_uInt16

Change-Id: I5d39bebbd55cc3170ff52459731fad333a2e92f9
üst 8d669758
...@@ -416,10 +416,10 @@ Polygon::Polygon( const Point& rCenter, long nRadX, long nRadY, sal_uInt16 nPoin ...@@ -416,10 +416,10 @@ Polygon::Polygon( const Point& rCenter, long nRadX, long nRadY, sal_uInt16 nPoin
// Compute default (depends on size) // Compute default (depends on size)
if( !nPoints ) if( !nPoints )
{ {
nPoints = (sal_uInt16) ( F_PI * ( 1.5 * ( nRadX + nRadY ) - nPoints = (sal_uInt16) MinMax(
sqrt( (double) labs( nRadX * nRadY ) ) ) ); ( F_PI * ( 1.5 * ( nRadX + nRadY ) -
sqrt( (double) labs( nRadX * nRadY ) ) ) ),
nPoints = (sal_uInt16) MinMax( nPoints, 32, 256 ); 32, 256 );
if( ( nRadX > 32 ) && ( nRadY > 32 ) && ( nRadX + nRadY ) < 8192 ) if( ( nRadX > 32 ) && ( nRadY > 32 ) && ( nRadX + nRadY ) < 8192 )
nPoints >>= 1; nPoints >>= 1;
...@@ -471,10 +471,10 @@ Polygon::Polygon( const Rectangle& rBound, const Point& rStart, const Point& rEn ...@@ -471,10 +471,10 @@ Polygon::Polygon( const Rectangle& rBound, const Point& rStart, const Point& rEn
const long nRadY = aCenter.Y() - rBound.Top(); const long nRadY = aCenter.Y() - rBound.Top();
sal_uInt16 nPoints; sal_uInt16 nPoints;
nPoints = (sal_uInt16) ( F_PI * ( 1.5 * ( nRadX + nRadY ) - nPoints = (sal_uInt16) MinMax(
sqrt( (double) labs( nRadX * nRadY ) ) ) ); ( F_PI * ( 1.5 * ( nRadX + nRadY ) -
sqrt( (double) labs( nRadX * nRadY ) ) ) ),
nPoints = (sal_uInt16) MinMax( nPoints, 32, 256 ); 32, 256 );
if( ( nRadX > 32 ) && ( nRadY > 32 ) && ( nRadX + nRadY ) < 8192 ) if( ( nRadX > 32 ) && ( nRadY > 32 ) && ( nRadX + nRadY ) < 8192 )
nPoints >>= 1; nPoints >>= 1;
......
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