From 6bd1283cbdf90cef915ed93867d266ec0126c274 Mon Sep 17 00:00:00 2001 From: Evo Stamatov Date: Tue, 1 May 2018 09:57:57 +1000 Subject: [PATCH 1/3] remove quiver dep --- flutter_map/FLUTTER_AUTHORS | 23 +++++++++ flutter_map/lib/src/layer/tile_layer.dart | 60 ++++++++++++++++++++++- flutter_map/pubspec.yaml | 1 - 3 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 flutter_map/FLUTTER_AUTHORS diff --git a/flutter_map/FLUTTER_AUTHORS b/flutter_map/FLUTTER_AUTHORS new file mode 100644 index 000000000..26cc1e964 --- /dev/null +++ b/flutter_map/FLUTTER_AUTHORS @@ -0,0 +1,23 @@ +# Below is a list of people and organizations that have contributed +# to the Flutter project. Names should be added to the list like so: +# +# Name/Organization + +Google Inc. +Jim Simon +Lex Berezhny +Wyatt Arent +Michael Perrotte +Günter Zöchbauer +Raju Bitter +Michael Beckler +Alexandre Ardhuin +Luke Freeman +Vincent Le Quéméner +Mike Hoolehan +German Saprykin +Stefano Rodriguez +Yusuke Konishi +Fredrik Simón +Ali Bitek +Tetsuhiro Ueda diff --git a/flutter_map/lib/src/layer/tile_layer.dart b/flutter_map/lib/src/layer/tile_layer.dart index fec802729..b342957c1 100644 --- a/flutter_map/lib/src/layer/tile_layer.dart +++ b/flutter_map/lib/src/layer/tile_layer.dart @@ -8,7 +8,6 @@ import 'package:flutter_map/src/core/point.dart'; import 'package:flutter_map/src/map/map.dart'; import 'package:flutter_map/src/core/util.dart' as util; import 'package:tuple/tuple.dart'; -import 'package:quiver/core.dart'; import 'layer.dart'; class TileLayerOptions extends LayerOptions { @@ -395,5 +394,62 @@ class Coords extends Point { return false; } - int get hashCode => hash3(x, y, z); + int get hashCode => _JenkinsSmiHash.hash3(x, y, z); +} + +// Copyright (c) 2016, the Dart project authors. Please see the FLUTTER_AUTHORS +// file for details. All rights reserved. Use of this source code is governed by +// a BSD-style license that can be found in the LICENSE file. +// +// Original commit in quiver-dart by Justin Fagnani +// https://github.com/google/quiver-dart/commit/28e2805fc323e34ddd81b972745ee5b57cd2058e + +/// Jenkins hash function, optimized for small integers. +/// +/// Static methods borrowed from sdk/lib/math/jenkins_smi_hash.dart. Non-static +/// methods are an enhancement for the "front_end" package. +/// +/// Where performance is critical, use [hash2], [hash3], or [hash4], or the +/// pattern `finish(combine(combine(...combine(0, a), b)..., z))`, where a..z +/// are hash codes to be combined. +/// +/// For ease of use, you may also use this pattern: +/// `(new JenkinsSmiHash()..add(a)..add(b)....add(z)).hashCode`, where a..z are +/// the sub-objects whose hashes should be combined. This pattern performs the +/// same operations as the performance critical variant, but allocates an extra +/// object. +class _JenkinsSmiHash { + /// Accumulates the hash code [value] into the running hash [hash]. + static int combine(int hash, int value) { + hash = 0x1fffffff & (hash + value); + hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); + return hash ^ (hash >> 6); + } + + /// Finalizes a running hash produced by [combine]. + static int finish(int hash) { + hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); + hash = hash ^ (hash >> 11); + return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); + } + + /// Combines together two hash codes. + static int hash2(a, b) => finish(combine(combine(0, a), b)); + + /// Combines together three hash codes. + static int hash3(a, b, c) => finish(combine(combine(combine(0, a), b), c)); + + /// Combines together four hash codes. + static int hash4(a, b, c, d) => + finish(combine(combine(combine(combine(0, a), b), c), d)); + + int _hash = 0; + + /// Accumulates the object [o] into the hash. + void add(Object o) { + _hash = combine(_hash, o.hashCode); + } + + /// Finalizes the hash and return the resulting hashcode. + int get hashCode => finish(_hash); } diff --git a/flutter_map/pubspec.yaml b/flutter_map/pubspec.yaml index a6940d974..3e5835c53 100644 --- a/flutter_map/pubspec.yaml +++ b/flutter_map/pubspec.yaml @@ -13,4 +13,3 @@ dependencies: sdk: flutter latlong: ^0.4.0 tuple: ^1.0.0 - quiver: ^0.28.0 From 61804882f4f872b8dc61f7dde07f4f299233b6e8 Mon Sep 17 00:00:00 2001 From: Evo Stamatov Date: Fri, 25 May 2018 15:40:11 +1000 Subject: [PATCH 2/3] use hachValues from `dart:ui` instead embedding `JenkinsSmiHash` --- flutter_map/FLUTTER_AUTHORS | 23 --------- flutter_map/lib/src/layer/tile_layer.dart | 59 +---------------------- 2 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 flutter_map/FLUTTER_AUTHORS diff --git a/flutter_map/FLUTTER_AUTHORS b/flutter_map/FLUTTER_AUTHORS deleted file mode 100644 index 26cc1e964..000000000 --- a/flutter_map/FLUTTER_AUTHORS +++ /dev/null @@ -1,23 +0,0 @@ -# Below is a list of people and organizations that have contributed -# to the Flutter project. Names should be added to the list like so: -# -# Name/Organization - -Google Inc. -Jim Simon -Lex Berezhny -Wyatt Arent -Michael Perrotte -Günter Zöchbauer -Raju Bitter -Michael Beckler -Alexandre Ardhuin -Luke Freeman -Vincent Le Quéméner -Mike Hoolehan -German Saprykin -Stefano Rodriguez -Yusuke Konishi -Fredrik Simón -Ali Bitek -Tetsuhiro Ueda diff --git a/flutter_map/lib/src/layer/tile_layer.dart b/flutter_map/lib/src/layer/tile_layer.dart index 18d02bb9e..e52e396ef 100644 --- a/flutter_map/lib/src/layer/tile_layer.dart +++ b/flutter_map/lib/src/layer/tile_layer.dart @@ -397,62 +397,5 @@ class Coords extends Point { return false; } - int get hashCode => _JenkinsSmiHash.hash3(x, y, z); -} - -// Copyright (c) 2016, the Dart project authors. Please see the FLUTTER_AUTHORS -// file for details. All rights reserved. Use of this source code is governed by -// a BSD-style license that can be found in the LICENSE file. -// -// Original commit in quiver-dart by Justin Fagnani -// https://github.com/google/quiver-dart/commit/28e2805fc323e34ddd81b972745ee5b57cd2058e - -/// Jenkins hash function, optimized for small integers. -/// -/// Static methods borrowed from sdk/lib/math/jenkins_smi_hash.dart. Non-static -/// methods are an enhancement for the "front_end" package. -/// -/// Where performance is critical, use [hash2], [hash3], or [hash4], or the -/// pattern `finish(combine(combine(...combine(0, a), b)..., z))`, where a..z -/// are hash codes to be combined. -/// -/// For ease of use, you may also use this pattern: -/// `(new JenkinsSmiHash()..add(a)..add(b)....add(z)).hashCode`, where a..z are -/// the sub-objects whose hashes should be combined. This pattern performs the -/// same operations as the performance critical variant, but allocates an extra -/// object. -class _JenkinsSmiHash { - /// Accumulates the hash code [value] into the running hash [hash]. - static int combine(int hash, int value) { - hash = 0x1fffffff & (hash + value); - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); - } - - /// Finalizes a running hash produced by [combine]. - static int finish(int hash) { - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); - } - - /// Combines together two hash codes. - static int hash2(a, b) => finish(combine(combine(0, a), b)); - - /// Combines together three hash codes. - static int hash3(a, b, c) => finish(combine(combine(combine(0, a), b), c)); - - /// Combines together four hash codes. - static int hash4(a, b, c, d) => - finish(combine(combine(combine(combine(0, a), b), c), d)); - - int _hash = 0; - - /// Accumulates the object [o] into the hash. - void add(Object o) { - _hash = combine(_hash, o.hashCode); - } - - /// Finalizes the hash and return the resulting hashcode. - int get hashCode => finish(_hash); + int get hashCode => hashValues(x.hashCode, y.hashCode, z.hashCode); } From 3a40e298b6dd6a9b885a3883fb5fe0867c65be0b Mon Sep 17 00:00:00 2001 From: Evo Stamatov Date: Fri, 25 May 2018 16:48:12 +1000 Subject: [PATCH 3/3] actually remove quiver as dependency It was added back from upstream version update --- flutter_map/pubspec.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/flutter_map/pubspec.yaml b/flutter_map/pubspec.yaml index 82150b141..cd59fc90f 100644 --- a/flutter_map/pubspec.yaml +++ b/flutter_map/pubspec.yaml @@ -13,5 +13,4 @@ dependencies: sdk: flutter latlong: ^0.4.0 tuple: ^1.0.0 - quiver: ^0.29.0 transparent_image: ^0.1.0