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

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

Issue 1214833004: Split Size into Size and Offset. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: add the new files also 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
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;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698