Index: runtime/lib/double.dart |
diff --git a/runtime/lib/double.dart b/runtime/lib/double.dart |
index ade4b9317bcd75c3c5150c78372a803f8630516d..0266d75e7667c7a621fa5b580d7159d996eeea46 100644 |
--- a/runtime/lib/double.dart |
+++ b/runtime/lib/double.dart |
@@ -6,6 +6,12 @@ class _Double implements double { |
factory _Double.fromInteger(int value) |
native "Double_doubleFromInteger"; |
+ factory _Double.fromPixels(pixels value) { |
+ return _DoubleFromPixels(value._value); |
+ } |
+ static _Double _DoubleFromPixels(int value) |
+ native "Double_doubleFromPixels"; |
+ |
Type get runtimeType => double; |
// TODO: Make a stared static method for hashCode and _identityHashCode |
@@ -57,6 +63,7 @@ class _Double implements double { |
} |
bool _equal(double other) native "Double_equal"; |
bool _equalToInteger(int other) native "Double_equalToInteger"; |
+ bool _equalToPixels(pixels other) => _equal(other.toDouble()); |
bool operator <(num other) { |
return other > this; |
} |
@@ -91,6 +98,31 @@ class _Double implements double { |
bool _greaterThanFromInteger(int other) |
native "Double_greaterThanFromInteger"; |
+ double _addFromPixels(pixels other) { |
+ return new _Double.fromPixels(other)._add(this); |
+ } |
+ double _subFromPixels(pixels other) { |
+ return new _Double.fromPixels(other)._sub(this); |
+ } |
+ double _mulFromPixels(pixels other) { |
+ return new _Double.fromPixels(other)._mul(this); |
+ } |
+ double _divFromPixels(pixels other) { |
+ return new _Double.fromPixels(other)._div(this); |
+ } |
+ int _truncDivFromPixels(pixels other) { |
+ return new _Double.fromPixels(other)._trunc_div(this); |
+ } |
+ double _moduloFromPixels(pixels other) { |
+ return new _Double.fromPixels(other)._modulo(this); |
+ } |
+ double _remainderFromPixels(pixels other) { |
+ return new _Double.fromPixels(other)._remainder(this); |
+ } |
+ bool _greaterThanFromPixels(pixels other) { |
+ return new _Double.fromPixels(other)._greaterThan(this); |
+ } |
+ |
bool get isNegative native "Double_getIsNegative"; |
bool get isInfinite native "Double_getIsInfinite"; |
bool get isNaN native "Double_getIsNaN"; |
@@ -136,9 +168,15 @@ class _Double implements double { |
} |
int toInt() native "Double_toInt"; |
- num _toBigintOrDouble() { return this; } |
+ num _toBigintIfInteger() { return this; } |
+ num _toDoubleOrPixels() { return this; } |
double toDouble() { return this; } |
+ pixels toPixels() { |
+ return new _Pixels(_DoubleToPixels()); |
+ } |
+ void _DoubleToPixels() native "Double_toPixels"; |
+ |
static const int CACHE_SIZE_LOG2 = 3; |
static const int CACHE_LENGTH = 1 << (CACHE_SIZE_LOG2 + 1); |
static const int CACHE_MASK = CACHE_LENGTH - 1; |