comparison dwt/graphics/Path.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 5123b17c98ef
comparison
equal deleted inserted replaced
6:b903c16b6f48 7:e831403a80a9
217 public void addString(String string, float x, float y, Font font) { 217 public void addString(String string, float x, float y, Font font) {
218 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED); 218 if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
219 if (font is null) DWT.error(DWT.ERROR_NULL_ARGUMENT); 219 if (font is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
220 if (font.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT); 220 if (font.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
221 NSString str = NSString.stringWith(string); 221 NSString str = NSString.stringWith(string);
222 NSTextStorage textStorage = ((NSTextStorage)new NSTextStorage().alloc()); 222 NSTextStorage textStorage = (cast(NSTextStorage)new NSTextStorage().alloc());
223 textStorage.initWithString_(str); 223 textStorage.initWithString_(str);
224 NSLayoutManager layoutManager = (NSLayoutManager)new NSLayoutManager().alloc().init(); 224 NSLayoutManager layoutManager = cast(NSLayoutManager)new NSLayoutManager().alloc().init();
225 NSTextContainer textContainer = (NSTextContainer)new NSTextContainer().alloc(); 225 NSTextContainer textContainer = cast(NSTextContainer)new NSTextContainer().alloc();
226 NSSize size = new NSSize(); 226 NSSize size = new NSSize();
227 size.width = Float.MAX_VALUE; 227 size.width = Float.MAX_VALUE;
228 size.height = Float.MAX_VALUE; 228 size.height = Float.MAX_VALUE;
229 textContainer.initWithContainerSize(size); 229 textContainer.initWithContainerSize(size);
230 textStorage.addLayoutManager(layoutManager); 230 textStorage.addLayoutManager(layoutManager);
411 int element = handle.elementAtIndex_associatedPoints_(i, points); 411 int element = handle.elementAtIndex_associatedPoints_(i, points);
412 switch (element) { 412 switch (element) {
413 case OS.NSMoveToBezierPathElement: 413 case OS.NSMoveToBezierPathElement:
414 types[typeCount++] = DWT.PATH_MOVE_TO; 414 types[typeCount++] = DWT.PATH_MOVE_TO;
415 OS.memmove(pt, points, NSPoint.sizeof); 415 OS.memmove(pt, points, NSPoint.sizeof);
416 pointArray[pointCount++] = (int)pt.x; 416 pointArray[pointCount++] = cast(int)pt.x;
417 pointArray[pointCount++] = (int)pt.y; 417 pointArray[pointCount++] = cast(int)pt.y;
418 break; 418 break;
419 case OS.NSLineToBezierPathElement: 419 case OS.NSLineToBezierPathElement:
420 types[typeCount++] = DWT.PATH_LINE_TO; 420 types[typeCount++] = DWT.PATH_LINE_TO;
421 OS.memmove(pt, points, NSPoint.sizeof); 421 OS.memmove(pt, points, NSPoint.sizeof);
422 pointArray[pointCount++] = (int)pt.x; 422 pointArray[pointCount++] = cast(int)pt.x;
423 pointArray[pointCount++] = (int)pt.y; 423 pointArray[pointCount++] = cast(int)pt.y;
424 break; 424 break;
425 case OS.NSCurveToBezierPathElement: 425 case OS.NSCurveToBezierPathElement:
426 types[typeCount++] = DWT.PATH_CUBIC_TO; 426 types[typeCount++] = DWT.PATH_CUBIC_TO;
427 OS.memmove(pt, points, NSPoint.sizeof); 427 OS.memmove(pt, points, NSPoint.sizeof);
428 pointArray[pointCount++] = (int)pt.x; 428 pointArray[pointCount++] = cast(int)pt.x;
429 pointArray[pointCount++] = (int)pt.y; 429 pointArray[pointCount++] = cast(int)pt.y;
430 OS.memmove(pt, points + NSPoint.sizeof, NSPoint.sizeof); 430 OS.memmove(pt, points + NSPoint.sizeof, NSPoint.sizeof);
431 pointArray[pointCount++] = (int)pt.x; 431 pointArray[pointCount++] = cast(int)pt.x;
432 pointArray[pointCount++] = (int)pt.y; 432 pointArray[pointCount++] = cast(int)pt.y;
433 OS.memmove(pt, points + NSPoint.sizeof + NSPoint.sizeof, NSPoint.sizeof); 433 OS.memmove(pt, points + NSPoint.sizeof + NSPoint.sizeof, NSPoint.sizeof);
434 pointArray[pointCount++] = (int)pt.x; 434 pointArray[pointCount++] = cast(int)pt.x;
435 pointArray[pointCount++] = (int)pt.y; 435 pointArray[pointCount++] = cast(int)pt.y;
436 break; 436 break;
437 case OS.NSClosePathBezierPathElement: 437 case OS.NSClosePathBezierPathElement:
438 types[typeCount++] = DWT.PATH_CLOSE; 438 types[typeCount++] = DWT.PATH_CLOSE;
439 break; 439 break;
440 } 440 }