Index: sky/engine/core/painting/Rect.dart |
diff --git a/sky/engine/core/painting/Rect.dart b/sky/engine/core/painting/Rect.dart |
index 4c958fdbcfe0c7a940cfd16c4874285218aa2fe9..8fdff2ef102c1c887ffc52135232a109d22e248b 100644 |
--- a/sky/engine/core/painting/Rect.dart |
+++ b/sky/engine/core/painting/Rect.dart |
@@ -22,12 +22,19 @@ class Rect { |
..[3] = point.y + size.height; |
} |
+ Rect.fromSize(Size size) { |
+ _value |
+ ..[2] = size.width |
+ ..[3] = size.height; |
+ } |
+ |
Rect.fromLTRB(double left, double top, double right, double bottom) { |
setLTRB(left, top, right, bottom); |
} |
Point get upperLeft => new Point(left, top); |
Point get lowerRight => new Point(right, bottom); |
+ Point get center => new Point(left + right / 2.0, top + bottom / 2.0); |
Size get size => new Size(right - left, bottom - top); |