changeset 16:0bee9065699b

some corrections
author Frank Benoit <benoit@tionex.de>
date Fri, 25 Jan 2008 19:45:34 +0100
parents 1bea9f0c6f63
children eca0c8261b9f
files dwt/graphics/Drawable.d dwt/graphics/FontMetrics.d dwt/graphics/PaletteData.d dwt/graphics/RGB.d
diffstat 4 files changed, 14 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/graphics/Drawable.d	Fri Jan 25 19:16:45 2008 +0100
+++ b/dwt/graphics/Drawable.d	Fri Jan 25 19:45:34 2008 +0100
@@ -14,6 +14,7 @@
 
 
 import dwt.graphics.GCData;
+import dwt.internal.win32.WINTYPES;
 
 /**
  * Implementers of <code>Drawable</code> can have a graphics context (GC)
@@ -47,7 +48,7 @@
  * @return the platform specific GC handle
  */
 
-public int /*long*/ internal_new_GC (GCData data);
+public HDC internal_new_GC (GCData data);
 
 /**
  * Invokes platform specific functionality to dispose a GC handle.
@@ -62,6 +63,6 @@
  * @param handle the platform specific GC handle
  * @param data the platform specific GC data
  */
-public void internal_dispose_GC ( int /*long*/ handle, GCData data);
+public void internal_dispose_GC ( HDC handle, GCData data);
 
 }
--- a/dwt/graphics/FontMetrics.d	Fri Jan 25 19:16:45 2008 +0100
+++ b/dwt/graphics/FontMetrics.d	Fri Jan 25 19:45:34 2008 +0100
@@ -36,7 +36,7 @@
      * platforms and should never be accessed from application code.
      * </p>
      */
-    public TEXTMETRIC handle;
+    public TEXTMETRIC* handle;
     
 /**
  * Prevents instances from being created outside the package.
@@ -57,7 +57,7 @@
 public int opEquals (Object object) {
     if (object is this) return true;
     if( auto metricObj = cast(FontMetrics)object ){
-        TEXTMETRIC metric = metricObj.handle;
+        auto metric = metricObj.handle;
         return handle.tmHeight is metric.tmHeight &&
             handle.tmAscent is metric.tmAscent &&
             handle.tmDescent is metric.tmDescent &&
@@ -175,7 +175,7 @@
  * @param handle the <code>TEXTMETRIC</code> containing information about a font
  * @return a new font metrics object containing the specified <code>TEXTMETRIC</code>
  */
-public static FontMetrics win32_new(TEXTMETRIC handle) {
+public static FontMetrics win32_new(TEXTMETRIC* handle) {
     FontMetrics fontMetrics = new FontMetrics();
     fontMetrics.handle = handle;
     return fontMetrics;
--- a/dwt/graphics/PaletteData.d	Fri Jan 25 19:16:45 2008 +0100
+++ b/dwt/graphics/PaletteData.d	Fri Jan 25 19:45:34 2008 +0100
@@ -152,7 +152,7 @@
         return pixel;
     } else {
         for (int i = 0; i < colors.length; i++) {
-            if (colors[i] is rgb ) return i;
+            if (colors[i] ==/*eq*/ rgb ) return i;
         }
         /* The RGB did not exist in the palette */
         DWT.error(DWT.ERROR_INVALID_ARGUMENT);
--- a/dwt/graphics/RGB.d	Fri Jan 25 19:16:45 2008 +0100
+++ b/dwt/graphics/RGB.d	Fri Jan 25 19:45:34 2008 +0100
@@ -103,10 +103,10 @@
         DWT.error(DWT.ERROR_INVALID_ARGUMENT);
     }
     float r, g, b;
-    if (saturation == 0) {
+    if (saturation is 0) {
         r = g = b = brightness;
     } else {
-        if (hue == 360) hue = 0;
+        if (hue is 360) hue = 0;
         hue /= 60;
         int i = cast(int)hue;
         float f = hue - i;
@@ -168,12 +168,12 @@
     float delta = max - min;
     float hue = 0;
     float brightness = max;
-    float saturation = max == 0 ? 0 : (max - min) / max;
-    if (delta != 0) {
-        if (r == max) {
+    float saturation = max is 0 ? 0 : (max - min) / max;
+    if (delta !is 0) {
+        if (r is max) {
             hue = (g  - b) / delta;
         } else {
-            if (g == max) {
+            if (g is max) {
                 hue = 2 + (b - r) / delta;
             } else {
                 hue = 4 + (r - g) / delta;
@@ -198,7 +198,7 @@
 public override int opEquals(Object object) {
     if (object is this) return true;
     if( auto rgb = cast(RGB) object ){
-        return (rgb.red == this.red) && (rgb.green == this.green) && (rgb.blue == this.blue);
+        return (rgb.red is this.red) && (rgb.green is this.green) && (rgb.blue is this.blue);
     }
     return false;
 }