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

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

Issue 1172173002: Clean up a bunch of our Dart code. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: upstream merge 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.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 eb82fd44d16b6bfe255ae4858ab819f4fdd8fc64..5a7b6cb74e5b87150eba53044d805eafd5ae655d 100644
--- a/sky/engine/core/painting/Rect.dart
+++ b/sky/engine/core/painting/Rect.dart
@@ -6,14 +6,16 @@ part of dart.sky;
/// Holds 4 floating-point coordinates for a rectangle.
class Rect {
- final Float32List _value = new Float32List(4);
- double get left => _value[0];
- double get top => _value[1];
- double get right => _value[2];
- double get bottom => _value[3];
-
Rect();
+ Rect.fromLTRB(double left, double top, double right, double bottom) {
+ _value
+ ..[0] = left
+ ..[1] = top
+ ..[2] = right
+ ..[3] = bottom;
+ }
+
Rect.fromPointAndSize(Point point, Size size) {
_value
..[0] = point.x
@@ -28,13 +30,11 @@ class Rect {
..[3] = size.height;
}
- Rect.fromLTRB(double left, double top, double right, double bottom) {
- _value
- ..[0] = left
- ..[1] = top
- ..[2] = right
- ..[3] = bottom;
- }
+ final Float32List _value = new Float32List(4);
+ double get left => _value[0];
+ double get top => _value[1];
+ double get right => _value[2];
+ double get bottom => _value[3];
Point get upperLeft => new Point(left, top);
Point get lowerRight => new Point(right, bottom);
@@ -58,8 +58,6 @@ class Rect {
return true;
}
- int get hashCode {
- return _value.fold(373, (value, item) => (37 * value + item.hashCode));
- }
+ 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.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698