| Index: runtime/lib/typed_data.dart
|
| ===================================================================
|
| --- runtime/lib/typed_data.dart (revision 33497)
|
| +++ runtime/lib/typed_data.dart (working copy)
|
| @@ -56,8 +56,6 @@
|
| int length]) {
|
| return new _Uint8ClampedArrayView(buffer, offsetInBytes, length);
|
| }
|
| -
|
| - bool _isClamped() { return true; }
|
| }
|
|
|
|
|
| @@ -528,8 +526,6 @@
|
| return IterableMixinWorkaround.getRangeList(this, start, end);
|
| }
|
|
|
| - bool _isClamped() { return false; }
|
| -
|
| void setRange(int start, int end, Iterable from, [int skipCount = 0]) {
|
| // Check ranges.
|
| if ((start < 0) || (start > length)) {
|
| @@ -551,18 +547,14 @@
|
| }
|
|
|
| if (from is _TypedListBase) {
|
| - final needsClamping =
|
| - this._isClamped() && (this._isClamped() != from._isClamped());
|
| if (this.elementSizeInBytes == from.elementSizeInBytes) {
|
| - if (needsClamping) {
|
| - Lists.copy(from, skipCount, this, start, count);
|
| + if (this.buffer._setRange(
|
| + start * elementSizeInBytes + this.offsetInBytes,
|
| + count * elementSizeInBytes,
|
| + from.buffer,
|
| + skipCount * elementSizeInBytes + from.offsetInBytes,
|
| + this._cid, from._cid)) {
|
| return;
|
| - } else if (this.buffer._setRange(
|
| - start * elementSizeInBytes + this.offsetInBytes,
|
| - count * elementSizeInBytes,
|
| - from.buffer,
|
| - skipCount * elementSizeInBytes + from.offsetInBytes)) {
|
| - return;
|
| }
|
| } else if (from.buffer == this.buffer) {
|
| // Different element sizes, but same buffer means that we need
|
| @@ -602,11 +594,16 @@
|
| // Internal utility methods.
|
|
|
| // Returns true if operation succeeds.
|
| - // Returns false if 'from' and 'this' do not have the same element types.
|
| - // The copy occurs using a memory copy (no clamping, conversion, etc).
|
| + // 'fromCid' and 'toCid' may be cid-s of the views and therefore may not
|
| + // match the cids of 'this' and 'from'.
|
| + // Uses toCid and fromCid to decide if clamping is necessary.
|
| + // Element size of toCid and fromCid must match (test at caller).
|
| bool _setRange(int startInBytes, int lengthInBytes,
|
| - _TypedListBase from, int startFromInBytes)
|
| + _TypedListBase from, int startFromInBytes,
|
| + int toCid, int fromCid)
|
| native "TypedData_setRange";
|
| +
|
| + int get _cid native "Object_cid";
|
| }
|
|
|
|
|
| @@ -797,8 +794,6 @@
|
| return new _Uint8ClampedArrayView(buffer, offsetInBytes, length);
|
| }
|
|
|
| - bool _isClamped() { return true; }
|
| -
|
| // Methods implementing List interface.
|
|
|
| int operator[](int index) {
|
| @@ -1624,8 +1619,6 @@
|
| return _new(length);
|
| }
|
|
|
| - bool _isClamped() { return true; }
|
| -
|
| // Method(s) implementing the List interface.
|
|
|
| int operator[](int index) {
|
| @@ -2660,8 +2653,6 @@
|
| }
|
|
|
|
|
| - bool _isClamped() { return true; }
|
| -
|
| // Method(s) implementing List interface.
|
|
|
| int operator[](int index) {
|
|
|