Mercurial > projects > dwt-linux
changeset 194:b6bee07cfc0b
Fix ==/!= to is/!is
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 06 Mar 2008 09:59:42 +0100 |
parents | cf2672c3e4fb |
children | e0ffca35fe59 |
files | dwt/graphics/Color.d dwt/graphics/Cursor.d dwt/graphics/FontData.d dwt/graphics/FontMetrics.d dwt/graphics/GC.d dwt/graphics/GlyphMetrics.d dwt/graphics/Path.d dwt/graphics/Transform.d |
diffstat | 8 files changed, 59 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/graphics/Color.d Tue Mar 04 20:02:45 2008 +0100 +++ b/dwt/graphics/Color.d Thu Mar 06 09:59:42 2008 +0100 @@ -124,7 +124,7 @@ int pixel = handle.pixel; if (device.colorRefCount !is null) { /* If this was the last reference, remove the color from the list */ - if (--device.colorRefCount[pixel] == 0) { + if (--device.colorRefCount[pixel] is 0) { device.gdkColors[pixel] = null; } } @@ -149,9 +149,9 @@ if (object is this) return true; if ( auto color = cast(Color)object ){ GdkColor* gdkColor = color.handle; - if (handle == gdkColor) return true; - return device == color.device && handle.red == gdkColor.red && - handle.green == gdkColor.green && handle.blue == gdkColor.blue; + if (handle is gdkColor) return true; + return device is color.device && handle.red is gdkColor.red && + handle.green is gdkColor.green && handle.blue is gdkColor.blue; } return false; } @@ -268,7 +268,7 @@ OS.gdk_colormap_alloc_color(colormap, gdkColor, true, true); } handle = gdkColor; - if (device.colorRefCount != null) { + if (device.colorRefCount !is null) { /* Make a copy of the color to put in the colors array */ GdkColor* colorCopy = new GdkColor(); colorCopy.red = handle.red;
--- a/dwt/graphics/Cursor.d Tue Mar 04 20:02:45 2008 +0100 +++ b/dwt/graphics/Cursor.d Thu Mar 06 09:59:42 2008 +0100 @@ -133,8 +133,8 @@ * @see DWT#CURSOR_HAND */ public this(Device device, int style) { - if (device == null) device = Device.getDevice(); - if (device == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (device is null) device = Device.getDevice(); + if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); this.device = device; int shape = 0; switch (style) { @@ -163,7 +163,7 @@ default: DWT.error(DWT.ERROR_INVALID_ARGUMENT); } - if (shape == 0 && style == DWT.CURSOR_APPSTARTING) { + if (shape is 0 && style is DWT.CURSOR_APPSTARTING) { handle = createCursor(APPSTARTING_SRC, APPSTARTING_MASK, 32, 32, 2, 2, true); } else { handle = OS.gdk_cursor_new(shape); @@ -204,16 +204,16 @@ * </ul> */ public this(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) { - if (device == null) device = Device.getDevice(); - if (device == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (device is null) device = Device.getDevice(); + if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); this.device = device; - if (source == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); - if (mask == null) { - if (!(source.getTransparencyType() == DWT.TRANSPARENCY_MASK)) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (source is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (mask is null) { + if (!(source.getTransparencyType() is DWT.TRANSPARENCY_MASK)) DWT.error(DWT.ERROR_NULL_ARGUMENT); mask = source.getTransparencyMask(); } /* Check the bounds. Mask must be the same size as source */ - if (mask.width != source.width || mask.height != source.height) { + if (mask.width !is source.width || mask.height !is source.height) { DWT.error(DWT.ERROR_INVALID_ARGUMENT); } /* Check the hotspots */ @@ -289,10 +289,10 @@ * @since 3.0 */ public this(Device device, ImageData source, int hotspotX, int hotspotY) { - if (device == null) device = Device.getDevice(); - if (device == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (device is null) device = Device.getDevice(); + if (device is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); this.device = device; - if (source == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (source is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (hotspotX >= source.width || hotspotX < 0 || hotspotY >= source.height || hotspotY < 0) { DWT.error(DWT.ERROR_INVALID_ARGUMENT); @@ -307,7 +307,7 @@ int stride = OS.gdk_pixbuf_get_rowstride(pixbuf); auto data = OS.gdk_pixbuf_get_pixels(pixbuf); byte[] buffer = source.data; - if (!palette.isDirect || source.depth != 24 || stride != source.bytesPerLine || palette.redMask != 0xFF000000 || palette.greenMask != 0xFF0000 || palette.blueMask != 0xFF00) { + if (!palette.isDirect || source.depth !is 24 || stride !is source.bytesPerLine || palette.redMask !is 0xFF000000 || palette.greenMask !is 0xFF0000 || palette.blueMask !is 0xFF00) { buffer = new byte[source.width * source.height * 4]; if (palette.isDirect) { ImageData.blit(ImageData.BLIT_SRC, @@ -323,7 +323,7 @@ byte[] srcBlues = new byte[length]; for (int i = 0; i < rgbs.length; i++) { RGB rgb = rgbs[i]; - if (rgb == null) continue; + if (rgb is null) continue; srcReds[i] = cast(byte)rgb.red; srcGreens[i] = cast(byte)rgb.green; srcBlues[i] = cast(byte)rgb.blue; @@ -334,24 +334,24 @@ buffer, 32, source.width * 4, ImageData.MSB_FIRST, 0, 0, source.width, source.height, 0xFF000000, 0xFF0000, 0xFF00, false, false); } - if (source.maskData != null || source.transparentPixel != -1) { + if (source.maskData !is null || source.transparentPixel !is -1) { ImageData mask = source.getTransparencyMask(); byte[] maskData = mask.data; int maskBpl = mask.bytesPerLine; int offset = 3, maskOffset = 0; for (int y = 0; y<source.height; y++) { for (int x = 0; x<source.width; x++) { - buffer[offset] = ((maskData[maskOffset + (x >> 3)]) & (1 << (7 - (x & 0x7)))) != 0 ? cast(byte)0xff : 0; + buffer[offset] = ((maskData[maskOffset + (x >> 3)]) & (1 << (7 - (x & 0x7)))) !is 0 ? cast(byte)0xff : 0; offset += 4; } maskOffset += maskBpl; } - } else if (source.alpha != -1) { + } else if (source.alpha !is -1) { byte alpha = cast(byte)source.alpha; for (int i=3; i<buffer.length; i+=4) { buffer[i] = alpha; } - } else if (source.alphaData != null) { + } else if (source.alphaData !is null) { byte[] alphaData = source.alphaData; for (int i=3; i<buffer.length; i+=4) { buffer[i] = alphaData[i/4]; @@ -390,7 +390,7 @@ byte[] srcBlues = new byte[length]; for (int i = 0; i < rgbs.length; i++) { RGB rgb = rgbs[i]; - if (rgb == null) continue; + if (rgb is null) continue; srcReds[i] = cast(byte)rgb.red; srcGreens[i] = cast(byte)rgb.green; srcBlues[i] = cast(byte)rgb.blue; @@ -503,7 +503,7 @@ * @private */ public static Cursor gtk_new(Device device, GdkCursor* handle) { - if (device == null) device = Device.getDevice(); + if (device is null) device = Device.getDevice(); Cursor cursor = new Cursor(); cursor.handle = handle; cursor.device = device;
--- a/dwt/graphics/FontData.d Tue Mar 04 20:02:45 2008 +0100 +++ b/dwt/graphics/FontData.d Thu Mar 06 09:59:42 2008 +0100 @@ -127,22 +127,22 @@ if (str is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); int start = 0; int end = locate( str, '|' ); - if (end == str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); + if (end is str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); char[] version1 = str[ start .. end ]; try { - if (to!(int)(version1) != 1) DWT.error(DWT.ERROR_INVALID_ARGUMENT); + if (to!(int)(version1) !is 1) DWT.error(DWT.ERROR_INVALID_ARGUMENT); } catch (ConversionException e) { DWT.error(DWT.ERROR_INVALID_ARGUMENT); } start = end + 1; end = locate( str, '|', start ); - if (end == str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); + if (end is str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); char[] name = str[start .. end ]; start = end + 1; end = locate( str, '|', start ); - if (end == str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); + if (end is str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); float height = 0; try { height = to!(float)(str[start .. end]); @@ -152,7 +152,7 @@ start = end + 1; end = locate( str, '|', start ); - if (end == str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); + if (end is str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT); int style = 0; try { style = to!(int)( str[start .. end ]); @@ -165,15 +165,15 @@ setName(name); setHeight(height); setStyle(style); - if (end == str.length) return; + if (end is str.length) return; char[] platform = str[ start .. end ]; start = end + 1; end = locate( str, '|', start ); - if (end == str.length) return; + if (end is str.length) return; char[] version2 = str[ start .. end ]; - if (platform == "GTK" && version2 == "1" ) { + if (platform.equals("GTK") && version2.equals("1")) { return; } } @@ -217,7 +217,7 @@ public override int opEquals (Object object) { if (object is this) return true; if( auto data = cast(FontData)object ){ - return name == data.name && height == data.height && style == data.style; + return name.equals(data.name) && height is data.height && style is data.style; } return false; } @@ -257,20 +257,20 @@ public char[] getLocale () { char[] result; const char sep = '_'; - if (lang != null) { + if (lang !is null) { result ~= lang; result ~= sep; } - if (country != null) { + if (country !is null) { result ~= country; result ~= sep; } - if (variant != null) { + if (variant !is null) { result ~= variant; } if (result) { - if (result[$-1] == sep) { + if (result[$-1] is sep) { result = result[0 .. $ - 1]; } } @@ -367,11 +367,11 @@ int firstSep, secondSep; firstSep = locate( locale, sep ); - if (firstSep == locale.length) { + if (firstSep is locale.length) { firstSep = secondSep = length; } else { secondSep = locate( locale, sep, firstSep + 1); - if (secondSep == locale.length) secondSep = length; + if (secondSep is locale.length) secondSep = length; } if (firstSep > 0) lang = locale[0 .. firstSep]; if (secondSep > firstSep + 1) country = locale[firstSep + 1 .. secondSep ];
--- a/dwt/graphics/FontMetrics.d Tue Mar 04 20:02:45 2008 +0100 +++ b/dwt/graphics/FontMetrics.d Thu Mar 06 09:59:42 2008 +0100 @@ -41,9 +41,9 @@ public override int opEquals (Object object) { if (object is this) return true; if( auto metrics = cast(FontMetrics)object ){ - return ascent == metrics.ascent && descent == metrics.descent && - averageCharWidth == metrics.averageCharWidth && leading == metrics.leading && - height == metrics.height; + return ascent is metrics.ascent && descent is metrics.descent && + averageCharWidth is metrics.averageCharWidth && leading is metrics.leading && + height is metrics.height; } return false; }
--- a/dwt/graphics/GC.d Tue Mar 04 20:02:45 2008 +0100 +++ b/dwt/graphics/GC.d Thu Mar 06 09:59:42 2008 +0100 @@ -1818,7 +1818,7 @@ fromRGB = backgroundRGB; toRGB = foregroundRGB; } - if (fromRGB ==/*eq*/ toRGB ) { + if (fromRGB.opEquals(toRGB)) { fillRectangle(x, y, width, height); return; }
--- a/dwt/graphics/GlyphMetrics.d Tue Mar 04 20:02:45 2008 +0100 +++ b/dwt/graphics/GlyphMetrics.d Thu Mar 06 09:59:42 2008 +0100 @@ -80,7 +80,7 @@ public override int opEquals (Object object) { if (object is this) return true; if (auto metrics = cast(GlyphMetrics)object ){ - return metrics.ascent == ascent && metrics.descent == descent && metrics.width == width; + return metrics.ascent is ascent && metrics.descent is descent && metrics.width is width; } return false; }
--- a/dwt/graphics/Path.d Tue Mar 04 20:02:45 2008 +0100 +++ b/dwt/graphics/Path.d Thu Mar 06 09:59:42 2008 +0100 @@ -125,7 +125,7 @@ public void addArc(float x, float y, float width, float height, float startAngle, float arcAngle) { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); moved = true; - if (width == height) { + if (width is height) { float angle = -startAngle * cast(float)Compatibility.PI / 180; if (closed) Cairo.cairo_move_to(handle, (x + width / 2f) + width / 2f * Math.cos(angle), (y + height / 2f) + height / 2f * Math.sin(angle)); if (arcAngle >= 0) { @@ -213,7 +213,7 @@ */ public void addString(char[] str, float x, float y, Font font) { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - if (font == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (font is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (font.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); moved = false; GC.addCairoString(handle, str, x, y, font); @@ -261,7 +261,7 @@ */ public bool contains(float x, float y, GC gc, bool outline) { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - if (gc == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (gc is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (gc.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); //TODO - see Windows gc.initCairo(); @@ -273,9 +273,9 @@ Cairo.cairo_append_path(cairo, copy); Cairo.cairo_path_destroy(copy); if (outline) { - result = Cairo.cairo_in_stroke(cairo, x, y) != 0; + result = Cairo.cairo_in_stroke(cairo, x, y) !is 0; } else { - result = Cairo.cairo_in_fill(cairo, x, y) != 0; + result = Cairo.cairo_in_fill(cairo, x, y) !is 0; } Cairo.cairo_new_path(cairo); return result; @@ -324,7 +324,7 @@ */ public void getBounds(float[] bounds) { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - if (bounds == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (bounds is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (bounds.length < 4) DWT.error(DWT.ERROR_INVALID_ARGUMENT); auto copy = Cairo.cairo_copy_path(handle); if (copy is null) DWT.error(DWT.ERROR_NO_HANDLES); @@ -394,7 +394,7 @@ */ public void getCurrentPoint(float[] point) { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - if (point == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (point is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (point.length < 2) DWT.error(DWT.ERROR_INVALID_ARGUMENT); double x, y; Cairo.cairo_get_current_point(handle, &x, &y); @@ -455,12 +455,12 @@ i += data.header.length; } } - if (typeIndex != types.length) { + if (typeIndex !is types.length) { byte[] newTypes = new byte[typeIndex]; System.arraycopy(types, 0, newTypes, 0, typeIndex); types = newTypes; } - if (ptsIndex != pts.length) { + if (ptsIndex !is pts.length) { float[] newPts = new float[ptsIndex]; System.arraycopy(pts, 0, newPts, 0, ptsIndex); pts = newPts;
--- a/dwt/graphics/Transform.d Tue Mar 04 20:02:45 2008 +0100 +++ b/dwt/graphics/Transform.d Thu Mar 06 09:59:42 2008 +0100 @@ -144,7 +144,7 @@ } static float[] checkTransform(float[] elements) { - if (elements == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (elements is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (elements.length < 6) DWT.error(DWT.ERROR_INVALID_ARGUMENT); return elements; } @@ -199,7 +199,7 @@ */ public void invert() { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - if (Cairo.cairo_matrix_invert(cast(cairo_matrix_t*)handle.ptr) != 0) { + if (Cairo.cairo_matrix_invert(cast(cairo_matrix_t*)handle.ptr) !is 0) { DWT.error(DWT.ERROR_CANNOT_INVERT_MATRIX); } } @@ -228,7 +228,7 @@ if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); float[] m = new float[6]; getElements(m); - return m[0] == 1 && m[1] == 0 && m[2] == 0 && m[3] == 1 && m[4] == 0 && m[5] == 0; + return m[0] is 1 && m[1] is 0 && m[2] is 0 && m[3] is 1 && m[4] is 0 && m[5] is 0; } /** @@ -248,7 +248,7 @@ */ public void multiply(Transform matrix) { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - if (matrix == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (matrix is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); if (matrix.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); Cairo.cairo_matrix_multiply(cast(cairo_matrix_t*)handle.ptr,cast(cairo_matrix_t*)matrix.handle.ptr, cast(cairo_matrix_t*)handle.ptr); } @@ -323,7 +323,7 @@ */ public void transform(float[] pointArray) { if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); - if (pointArray == null) DWT.error(DWT.ERROR_NULL_ARGUMENT); + if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); double dx, dy; int length = pointArray.length / 2; for (int i = 0, j = 0; i < length; i++, j += 2) {