OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 part of dart.sky; | 5 part of dart.sky; |
6 | 6 |
7 /// Holds a 2D floating-point size. | 7 /// Holds a 2D floating-point size. |
8 class Size { | 8 class Size { |
9 double width; | 9 double width; |
10 double height; | 10 double height; |
11 | 11 |
12 Size(this.width, this.height); | 12 Size(this.width, this.height); |
13 | 13 |
| 14 Size.infinite() : width = double.INFINITY, height = double.INFINITY; |
| 15 |
14 bool operator ==(other) { | 16 bool operator ==(other) { |
15 if (!(other is Size)) return false; | 17 if (!(other is Size)) return false; |
16 return width == other.width && height == other.height; | 18 return width == other.width && height == other.height; |
17 } | 19 } |
18 int get hashCode { | 20 int get hashCode { |
19 int result = 373; | 21 int result = 373; |
20 result = 37 * result + width.hashCode; | 22 result = 37 * result + width.hashCode; |
21 result = 37 * result + height.hashCode; | 23 result = 37 * result + height.hashCode; |
22 return result; | 24 return result; |
23 } | 25 } |
24 String toString() => "Size($width, $height)"; | 26 String toString() => "Size($width, $height)"; |
25 } | 27 } |
OLD | NEW |