Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2476)

Unified Diff: sky/engine/core/painting/Rect.dart

Issue 1156303004: Use Point, Size, and Rect in layout2.dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: address review comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/engine/core/painting/Size.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | sky/engine/core/painting/Size.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698