changeset 5:daf5407a1394

Fixed wrong replacement
author Frank Benoit <benoit@tionex.de>
date Wed, 04 Mar 2009 23:50:32 +0100
parents 6bf2837c50fe
children f36c67707cb3
files java/src/java/lang/Math.d org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.d
diffstat 2 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/java/src/java/lang/Math.d	Wed Mar 04 23:46:02 2009 +0100
+++ b/java/src/java/lang/Math.d	Wed Mar 04 23:50:32 2009 +0100
@@ -3,11 +3,14 @@
 static import tango.math.Math;
 
 class Math {
+
     public const double PI = tango.math.Math.PI;
+
     static double abs(double a){ return a > 0 ? a : -a; }
     static float  abs(float  a){ return a > 0 ? a : -a; }
     static int    abs(int    a){ return a > 0 ? a : -a; }
     static long   abs(long   a){ return a > 0 ? a : -a; }
+
     static double min(double a, double b){ return a < b ? a : b; }
     static float  min(float  a, float  b){ return a < b ? a : b; }
     static int    min(int    a, int    b){ return a < b ? a : b; }
@@ -15,6 +18,7 @@
     static int    min(int    a, uint   b){ return a < b ? a : b; }
     static int    min(uint   a, uint   b){ return a < b ? a : b; }
     static long   min(long   a, long   b){ return a < b ? a : b; }
+
     static double max(double a, double b){ return a > b ? a : b; }
     static float  max(float  a, float  b){ return a > b ? a : b; }
     static int    max(int    a, int    b){ return a > b ? a : b; }
@@ -22,13 +26,16 @@
     static int    max(int    a, uint   b){ return a > b ? a : b; }
     static int    max(uint   a, uint   b){ return a > b ? a : b; }
     static long   max(long   a, long   b){ return a > b ? a : b; }
+
+
+    static double sin(double a)  { return tango.math.Math.sin(a); }
+    static double cos(double a)  { return tango.math.Math.cos(a); }
+
     static long   round(double a) { return cast(long)tango.math.Math.round(a); }
     static int    round(float a)  { return cast(int)tango.math.Math.round(a); }
-    static double sin(double a)  { return tango.math.Math.sin(a); }
+    static double rint(double a) { return tango.math.Math.rndint(a); }
     static double ceil(double a) { return tango.math.Math.ceil(a); }
-    static double cos(double a)  { return tango.math.Math.cos(a); }
     static double floor(double a) { return tango.math.Math.floor(a); }
-    static double rint(double a) { return tango.math.Math.rndint(a); }
 }
 
 
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.d	Wed Mar 04 23:46:02 2009 +0100
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.d	Wed Mar 04 23:50:32 2009 +0100
@@ -2138,7 +2138,7 @@
         if (!isTransparent) {
             Gdip.RectF bounds;
             Gdip.Graphics_MeasureString(gdipGraphics, buffer, length_, data.gdipFont, pt, format, bounds);
-            Gdip.Graphics_FillRectangle(gdipGraphics, data.gdipBrush, x, y, cast(int)Math.rint(bounds.Width), cast(int)Math.rint(bounds.Height));
+            Gdip.Graphics_FillRectangle(gdipGraphics, data.gdipBrush, x, y, Math.round(bounds.Width), Math.round(bounds.Height));
         }
         int gstate = 0;
         auto brush = getFgBrush();
@@ -2330,7 +2330,7 @@
         if ((flags & SWT.DRAW_TRANSPARENT) is 0) {
             Gdip.RectF bounds;
             Gdip.Graphics_MeasureString(gdipGraphics, buffer, length_, data.gdipFont, pt, format, bounds);
-            Gdip.Graphics_FillRectangle(gdipGraphics, data.gdipBrush, x, y, cast(int)Math.rint(bounds.Width), cast(int)Math.rint(bounds.Height));
+            Gdip.Graphics_FillRectangle(gdipGraphics, data.gdipBrush, x, y, Math.round(bounds.Width), Math.round(bounds.Height));
         }
         int gstate = 0;
         auto brush = getFgBrush();
@@ -4752,7 +4752,7 @@
         Gdip.StringFormat_SetFormatFlags(format, formatFlags);
         Gdip.Graphics_MeasureString(data.gdipGraphics, buffer, length_, data.gdipFont, pt, format, bounds);
         Gdip.StringFormat_delete(format);
-        return new Point(length_ is 0 ? 0 : cast(int)Math.rint(bounds.Width), cast(int)Math.rint(bounds.Height));
+        return new Point(length_ is 0 ? 0 : Math.round(bounds.Width), Math.round(bounds.Height));
     }
     SIZE size;
     if (length_ is 0) {