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

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

Issue 1214833004: Split Size into Size and Offset. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 | « sky/engine/core/painting/Point.dart ('k') | sky/engine/core/painting/Size.h » ('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 5a7b6cb74e5b87150eba53044d805eafd5ae655d..0fc67baf296e63fb969d6af75e8679217315da21 100644
--- a/sky/engine/core/painting/Rect.dart
+++ b/sky/engine/core/painting/Rect.dart
@@ -24,6 +24,7 @@ class Rect {
..[3] = point.y + size.height;
}
+ // assumes top-left corner is at the origin (0,0)
Rect.fromSize(Size size) {
_value
..[2] = size.width
@@ -36,9 +37,11 @@ class Rect {
double get right => _value[2];
double get bottom => _value[3];
- 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);
+ Point get topLeft => new Point(left, top);
+ Point get topRight => new Point(right, top);
+ Point get bottomLeft => new Point(left, bottom);
+ Point get bottomRight => new Point(right, bottom);
Size get size => new Size(right - left, bottom - top);
@@ -57,7 +60,6 @@ class Rect {
}
return true;
}
-
int get hashCode =>_value.fold(373, (value, item) => (37 * value + item.hashCode));
String toString() => "Rect.fromLTRB($left, $top, $right, $bottom)";
}
« no previous file with comments | « sky/engine/core/painting/Point.dart ('k') | sky/engine/core/painting/Size.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698