diff dwt/graphics/Region.d @ 7:e831403a80a9

Add 'cast' to casts
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 14:30:35 +0200
parents 1a8b3cb347e0
children a9ab4c738ed8
line wrap: on
line diff
--- a/dwt/graphics/Region.d	Wed Aug 27 14:10:03 2008 +0200
+++ b/dwt/graphics/Region.d	Wed Aug 27 14:30:35 2008 +0200
@@ -114,11 +114,11 @@
     if (count <= 2) return;
     int polyRgn = OS.NewRgn();
     OS.OpenRgn();
-    OS.MoveTo((short)pointArray[0], (short)pointArray[1]);
+    OS.MoveTo(cast(short)pointArray[0], cast(short)pointArray[1]);
     for (int i = 1; i < count / 2; i++) {
-        OS.LineTo((short)pointArray[2 * i], (short)pointArray[2 * i + 1]);
+        OS.LineTo(cast(short)pointArray[2 * i], cast(short)pointArray[2 * i + 1]);
     }
-    OS.LineTo((short)pointArray[0], (short)pointArray[1]);
+    OS.LineTo(cast(short)pointArray[0], cast(short)pointArray[1]);
     OS.CloseRgn(polyRgn);
     OS.UnionRgn(handle, polyRgn, handle);
     OS.DisposeRgn(polyRgn);
@@ -168,7 +168,7 @@
     if (width < 0 || height < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
     int rectRgn = OS.NewRgn();
     short[] r = new short[4];
-    OS.SetRect(r, (short)x, (short)y, (short)(x + width),(short)(y + height));
+    OS.SetRect(r, cast(short)x, cast(short)y, cast(short)(x + width),cast(short)(y + height));
     OS.RectRgn(rectRgn, r);
     OS.UnionRgn(handle, rectRgn, handle);
     OS.DisposeRgn(rectRgn);
@@ -211,7 +211,7 @@
  */
 public bool contains(int x, int y) {
     if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
-    short[] point = new short[]{(short)x, (short)y};
+    short[] point = new short[]{cast(short)x, cast(short)y};
     return OS.PtInRgn(point, handle);
 }
 
@@ -260,19 +260,19 @@
         point.y = rect[0];
         point = transform.transformPoint(point);
         short startX, startY;
-        OS.MoveTo(startX = (short)point.x, startY = (short)point.y);
+        OS.MoveTo(startX = cast(short)point.x, startY = cast(short)point.y);
         point.x = rect[3];
         point.y = rect[0];
         point = transform.transformPoint(point);
-        OS.LineTo((short)Math.round(point.x), (short)point.y);
+        OS.LineTo(cast(short)Math.round(point.x), cast(short)point.y);
         point.x = rect[3];
         point.y = rect[2];
         point = transform.transformPoint(point);
-        OS.LineTo((short)Math.round(point.x), (short)Math.round(point.y));
+        OS.LineTo(cast(short)Math.round(point.x), cast(short)Math.round(point.y));
         point.x = rect[1];
         point.y = rect[2];
         point = transform.transformPoint(point);
-        OS.LineTo((short)point.x, (short)Math.round(point.y));
+        OS.LineTo(cast(short)point.x, cast(short)Math.round(point.y));
         OS.LineTo(startX, startY);
         OS.CloseRgn(polyRgn);
         OS.UnionRgn(newRgn, polyRgn, newRgn);
@@ -299,7 +299,7 @@
 public bool equals(Object object) {
     if (this is object) return true;
     if (!(object instanceof Region)) return false;
-    Region region = (Region)object;
+    Region region = cast(Region)object;
     return handle is region.handle;
 }
 
@@ -419,7 +419,7 @@
     if (width < 0 || height < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
     int rectRgn = OS.NewRgn();
     short[] r = new short[4];
-    OS.SetRect(r, (short)x, (short)y, (short)(x + width),(short)(y + height));
+    OS.SetRect(r, cast(short)x, cast(short)y, cast(short)(x + width),cast(short)(y + height));
     OS.RectRgn(rectRgn, r);
     OS.SectRgn(handle, rectRgn, handle);
     OS.DisposeRgn(rectRgn);
@@ -469,7 +469,7 @@
 public bool intersects (int x, int y, int width, int height) {
     if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
     short[] r = new short[4];
-    OS.SetRect(r, (short)x, (short)y, (short)(x + width),(short)(y + height));
+    OS.SetRect(r, cast(short)x, cast(short)y, cast(short)(x + width),cast(short)(y + height));
     return OS.RectInRgn(rect, handle);
 }
 
@@ -546,11 +546,11 @@
     if (pointArray.length < 2) return;
     int polyRgn = OS.NewRgn();
     OS.OpenRgn();
-    OS.MoveTo((short)pointArray[0], (short)pointArray[1]);
+    OS.MoveTo(cast(short)pointArray[0], cast(short)pointArray[1]);
     for (int i = 1; i < pointArray.length / 2; i++) {
-        OS.LineTo((short)pointArray[2 * i], (short)pointArray[2 * i + 1]);
+        OS.LineTo(cast(short)pointArray[2 * i], cast(short)pointArray[2 * i + 1]);
     }
-    OS.LineTo((short)pointArray[0], (short)pointArray[1]);
+    OS.LineTo(cast(short)pointArray[0], cast(short)pointArray[1]);
     OS.CloseRgn(polyRgn);
     OS.DiffRgn(handle, polyRgn, handle);
     OS.DisposeRgn(polyRgn);
@@ -601,7 +601,7 @@
     if (width < 0 || height < 0) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
     int rectRgn = OS.NewRgn();
     short[] r = new short[4];
-    OS.SetRect(r, (short)x, (short)y, (short)(x + width),(short)(y + height));
+    OS.SetRect(r, cast(short)x, cast(short)y, cast(short)(x + width),cast(short)(y + height));
     OS.RectRgn(rectRgn, r);
     OS.DiffRgn(handle, rectRgn, handle);
     OS.DisposeRgn(rectRgn);
@@ -646,7 +646,7 @@
  */
 public void translate (int x, int y) {
     if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
-    OS.OffsetRgn (handle, (short)x, (short)y);
+    OS.OffsetRgn (handle, cast(short)x, cast(short)y);
 }
 
 /**