diff org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.d @ 4:6bf2837c50fe

Created own class for Math
author Frank Benoit <benoit@tionex.de>
date Wed, 04 Mar 2009 23:46:02 +0100
parents 6dd524f61e62
children daf5407a1394
line wrap: on
line diff
--- a/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.d	Wed Mar 04 22:35:46 2009 +0100
+++ b/org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/graphics/GC.d	Wed Mar 04 23:46:02 2009 +0100
@@ -39,7 +39,6 @@
 import org.eclipse.swt.graphics.LineAttributes;
 
 import java.lang.all;
-import tango.text.convert.Format;
 
 /**
  * Class <code>GC</code> is where all of the drawing capabilities that are
@@ -256,10 +255,10 @@
                 case SWT.LINE_DASHDOTDOT: dashStyle = Gdip.DashStyleDashDotDot; if (width is 0) dashes = LINE_DASHDOTDOT_ZERO; break;
                 case SWT.LINE_CUSTOM: {
                     if (data.lineDashes !is null) {
-                        dashOffset = data.lineDashesOffset / Math.max (1, width);
+                        dashOffset = data.lineDashesOffset / Math.max (1.0f, width);
                         dashes = new float[data.lineDashes.length * 2];
                         for (int i = 0; i < data.lineDashes.length; i++) {
-                            float dash = data.lineDashes[i] / Math.max (1, width);
+                            float dash = data.lineDashes[i] / Math.max (1.0f, width);
                             dashes[i] = dash;
                             dashes[i + data.lineDashes.length] = dash;
                         }
@@ -2139,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, Math.rndint(bounds.Width), Math.rndint(bounds.Height));
+            Gdip.Graphics_FillRectangle(gdipGraphics, data.gdipBrush, x, y, cast(int)Math.rint(bounds.Width), cast(int)Math.rint(bounds.Height));
         }
         int gstate = 0;
         auto brush = getFgBrush();
@@ -2331,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, Math.rndint(bounds.Width), Math.rndint(bounds.Height));
+            Gdip.Graphics_FillRectangle(gdipGraphics, data.gdipBrush, x, y, cast(int)Math.rint(bounds.Width), cast(int)Math.rint(bounds.Height));
         }
         int gstate = 0;
         auto brush = getFgBrush();
@@ -4753,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 : Math.rndint(bounds.Width), Math.rndint(bounds.Height));
+        return new Point(length_ is 0 ? 0 : cast(int)Math.rint(bounds.Width), cast(int)Math.rint(bounds.Height));
     }
     SIZE size;
     if (length_ is 0) {
@@ -4844,7 +4843,7 @@
         Gdip.StringFormat_SetHotkeyPrefix(format, (flags & SWT.DRAW_MNEMONIC) !is 0 ? Gdip.HotkeyPrefixShow : Gdip.HotkeyPrefixNone);
         Gdip.Graphics_MeasureString(data.gdipGraphics, buffer, length_, data.gdipFont, pt, format, bounds);
         Gdip.StringFormat_delete(format);
-        return new Point(length_ is 0 ? 0 : Math.rndint(bounds.Width), Math.rndint(bounds.Height));
+        return new Point(length_ is 0 ? 0 : cast(int)Math.rint(bounds.Width), cast(int)Math.rint(bounds.Height));
     }
     if (string.length is 0) {
         SIZE size;