# HG changeset patch # User Frank Benoit # Date 1204497608 -3600 # Node ID df23b11d0b70a661cc683705235b0107809ce54d # Parent cd8dc3f1967907f12463efc59e7e3b1f24128924 minor changes to be more compatible to dwt-win, fixed potetial ==/is bugs. diff -r cd8dc3f19679 -r df23b11d0b70 dwt/graphics/PaletteData.d --- a/dwt/graphics/PaletteData.d Sun Mar 02 23:00:45 2008 +0100 +++ b/dwt/graphics/PaletteData.d Sun Mar 02 23:40:08 2008 +0100 @@ -109,7 +109,7 @@ * */ public this(RGB[] colors) { - if (colors == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (colors is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); this.colors = colors; this.isDirect = false; } @@ -152,7 +152,7 @@ return pixel; } else { for (int i = 0; i < colors.length; i++) { - if (colors[i] == rgb ) return i; + if (colors[i].opEquals(rgb) ) return i; } /* The RGB did not exist in the palette */ DWT.error(DWT.ERROR_INVALID_ARGUMENT); @@ -208,7 +208,7 @@ */ int shiftForMask(int mask) { for (int i = 31; i >= 0; i--) { - if (((mask >> i) & 0x1) != 0) return 7 - i; + if (((mask >> i) & 0x1) !is 0) return 7 - i; } return 32; } diff -r cd8dc3f19679 -r df23b11d0b70 dwt/graphics/Point.d --- a/dwt/graphics/Point.d Sun Mar 02 23:00:45 2008 +0100 +++ b/dwt/graphics/Point.d Sun Mar 02 23:40:08 2008 +0100 @@ -94,7 +94,7 @@ * * @see #equals(Object) */ -public override hash_t toHash () { +override public hash_t toHash () { return x ^ y; } @@ -104,7 +104,7 @@ * * @return a string representation of the point */ -public override char[] toString () { +override public char[] toString () { return Format( "Point {{{}, {}}", x, y );; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } diff -r cd8dc3f19679 -r df23b11d0b70 dwt/graphics/RGB.d --- a/dwt/graphics/RGB.d Sun Mar 02 23:00:45 2008 +0100 +++ b/dwt/graphics/RGB.d Sun Mar 02 23:40:08 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; } @@ -213,7 +213,7 @@ * * @see #equals(Object) */ -public override hash_t toHash() { +override public hash_t toHash() { return (blue << 16) | (green << 8) | red; }