[Libreoffice-commits] core.git: tools/source

Stephan Bergmann sbergman at redhat.com
Fri Aug 22 08:30:34 PDT 2014


 tools/source/generic/poly.cxx |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 3f89eccf7e4a0a398a02624e2478de805723f92b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Aug 22 17:30:03 2014 +0200

    Do not cripple intermediate values to sal_uInt16
    
    Change-Id: I5d39bebbd55cc3170ff52459731fad333a2e92f9

diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 2447271..e5ed7f2 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -416,10 +416,10 @@ Polygon::Polygon( const Point& rCenter, long nRadX, long nRadY, sal_uInt16 nPoin
         // Compute default (depends on size)
         if( !nPoints )
         {
-            nPoints = (sal_uInt16) ( F_PI * ( 1.5 * ( nRadX + nRadY ) -
-                                 sqrt( (double) labs( nRadX * nRadY ) ) ) );
-
-            nPoints = (sal_uInt16) MinMax( nPoints, 32, 256 );
+            nPoints = (sal_uInt16) MinMax(
+                ( F_PI * ( 1.5 * ( nRadX + nRadY ) -
+                           sqrt( (double) labs( nRadX * nRadY ) ) ) ),
+                32, 256 );
 
             if( ( nRadX > 32 ) && ( nRadY > 32 ) && ( nRadX + nRadY ) < 8192 )
                 nPoints >>= 1;
@@ -471,10 +471,10 @@ Polygon::Polygon( const Rectangle& rBound, const Point& rStart, const Point& rEn
         const long  nRadY = aCenter.Y() - rBound.Top();
         sal_uInt16  nPoints;
 
-        nPoints = (sal_uInt16) ( F_PI * ( 1.5 * ( nRadX + nRadY ) -
-                             sqrt( (double) labs( nRadX * nRadY ) ) ) );
-
-        nPoints = (sal_uInt16) MinMax( nPoints, 32, 256 );
+        nPoints = (sal_uInt16) MinMax(
+            ( F_PI * ( 1.5 * ( nRadX + nRadY ) -
+                       sqrt( (double) labs( nRadX * nRadY ) ) ) ),
+            32, 256 );
 
         if( ( nRadX > 32 ) && ( nRadY > 32 ) && ( nRadX + nRadY ) < 8192 )
             nPoints >>= 1;


More information about the Libreoffice-commits mailing list