Mercurial > projects > dwt-addons
comparison dwtx/draw2d/AbstractBorder.d @ 103:2d6540440fe6
Replace static ctors with lazy init.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 03 Aug 2008 17:01:51 +0200 |
parents | 95307ad235d9 |
children |
comparison
equal
deleted
inserted
replaced
102:0de61c6f08ca | 103:2d6540440fe6 |
---|---|
27 */ | 27 */ |
28 public abstract class AbstractBorder | 28 public abstract class AbstractBorder |
29 : Border | 29 : Border |
30 { | 30 { |
31 | 31 |
32 private static const Dimension EMPTY; | 32 private static Dimension EMPTY_; |
33 private static Dimension EMPTY(){ | |
34 if( EMPTY_ is null ){ | |
35 synchronized( AbstractBorder.classinfo ){ | |
36 if( EMPTY_ is null ){ | |
37 EMPTY_ = new Dimension(); | |
38 } | |
39 } | |
40 } | |
41 return EMPTY_; | |
42 } | |
33 | 43 |
34 /** A temporary Rectangle*/ | 44 /** A temporary Rectangle*/ |
35 protected static Rectangle tempRect; | 45 private static Rectangle tempRect_; |
36 | 46 protected static Rectangle tempRect(){ |
37 static this(){ | 47 if( tempRect_ is null ){ |
38 EMPTY = new Dimension(); | 48 synchronized( AbstractBorder.classinfo ){ |
39 tempRect = new Rectangle(); | 49 if( tempRect_ is null ){ |
50 tempRect_ = new Rectangle(); | |
51 } | |
52 } | |
53 } | |
54 return tempRect_; | |
40 } | 55 } |
41 | 56 |
42 /** | 57 /** |
43 * Returns a temporary rectangle representing the figure's bounds cropped by the specified | 58 * Returns a temporary rectangle representing the figure's bounds cropped by the specified |
44 * insets. This method exists for convenience and performance; the method does not new | 59 * insets. This method exists for convenience and performance; the method does not new |