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

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

Issue 1160453006: Provide Point+Size, Point-Point, Point.toSize(), and Rect.toPoint(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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 | « sky/engine/core/painting/Point.dart ('k') | 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 b0b7f7c40a0ffc78e7ea6aa061eb4368a8ba3d74..eb82fd44d16b6bfe255ae4858ab819f4fdd8fc64 100644
--- a/sky/engine/core/painting/Rect.dart
+++ b/sky/engine/core/painting/Rect.dart
@@ -44,18 +44,22 @@ class Rect {
// Rects are inclusive of the top and left edges but exclusive of the bottom
// right edges.
- bool contains(Point point) =>
- point.x >= left && point.x < right && point.y >= top && point.y < bottom;
+ bool contains(Point point) {
Matt Perry 2015/06/03 21:15:25 why this change?
Hixie 2015/06/09 21:06:49 Consistency. When it fits on one line, =>, when it
+ return point.x >= left && point.x < right && point.y >= top && point.y < bottom;
+ }
bool operator ==(other) {
- if (!(other is Rect)) return false;
+ if (other is! Rect)
+ return false;
for (var i = 0; i < 4; ++i) {
- if (_value[i] != other._value[i]) return false;
+ if (_value[i] != other._value[i])
+ return false;
Matt Perry 2015/06/03 21:15:25 ditto? Some of the formatting in this file was a
Hixie 2015/06/09 21:06:49 Having the if statement on the same line as the st
}
return true;
}
+
int get hashCode {
return _value.fold(373, (value, item) => (37 * value + item.hashCode));
}
- String toString() => "Rect.LTRB($left, $top, $right, $bottom)";
+ 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.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698