Chromium Code Reviews| Index: sky/engine/core/painting/OffsetBase.dart |
| diff --git a/sky/engine/core/painting/OffsetBase.dart b/sky/engine/core/painting/OffsetBase.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1f5a0cb5c90216e75d9598a2c8d6461d7151ad0a |
| --- /dev/null |
| +++ b/sky/engine/core/painting/OffsetBase.dart |
| @@ -0,0 +1,28 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +part of dart.sky; |
| + |
| +abstract class OffsetBase { |
| + const OffsetBase(this._dx, this._dy); |
| + |
| + final double _dx; |
| + final double _dy; |
| + |
| + bool get isInfinite => _dx >= double.INFINITY || _dy >= double.INFINITY; |
| + |
| + bool operator ==(other) { |
| + return other is OffsetBase && |
| + other.runtimeType == runtimeType && |
| + other._dx == _dx && |
| + other._dy == _dy; |
| + } |
| + |
| + int get hashCode { |
| + int result = 373; |
|
Chinmay
2015/06/26 21:55:18
Maybe we should move this way of constructing hash
|
| + result = 37 * result + _dx.hashCode; |
| + result = 37 * result + _dy.hashCode; |
| + return result; |
| + } |
| +} |