HTML5 typed array fix

This commit is contained in:
Joshua Granick
2015-07-06 17:14:50 -07:00
parent 722f0d2701
commit ee08c8c37e
9 changed files with 65 additions and 47 deletions

View File

@@ -8,7 +8,7 @@ package lime.utils;
from js.html.Float32Array from js.html.Float32Array
to js.html.Float32Array { to js.html.Float32Array {
public inline static var BYTES_PER_ELEMENT : Int = 4; public inline static var BYTES_PER_ELEMENT : Int = 4;
@:generic @:generic
public inline function new<T>( public inline function new<T>(
@@ -23,9 +23,11 @@ package lime.utils;
this = new js.html.Float32Array( untyped array ); this = new js.html.Float32Array( untyped array );
} else if(view != null) { } else if(view != null) {
this = new js.html.Float32Array( untyped view ); this = new js.html.Float32Array( untyped view );
} else if(buffer != null) { } else if (buffer != null) {
len = (len == null) ? untyped __js__('undefined') : len; if (len == null)
this = new js.html.Float32Array( buffer, byteoffset, len ); this = new js.html.Float32Array( buffer, byteoffset );
else
this = new js.html.Float32Array( buffer, byteoffset, len );
} else { } else {
this = null; this = null;
} }

View File

@@ -8,7 +8,7 @@ package lime.utils;
from js.html.Float64Array from js.html.Float64Array
to js.html.Float64Array { to js.html.Float64Array {
public inline static var BYTES_PER_ELEMENT : Int = 8; public inline static var BYTES_PER_ELEMENT : Int = 8;
@:generic @:generic
public inline function new<T>( public inline function new<T>(
@@ -23,9 +23,11 @@ package lime.utils;
this = new js.html.Float64Array( untyped array ); this = new js.html.Float64Array( untyped array );
} else if(view != null) { } else if(view != null) {
this = new js.html.Float64Array( untyped view ); this = new js.html.Float64Array( untyped view );
} else if(buffer != null) { } else if (buffer != null) {
len = (len == null) ? untyped __js__('undefined') : len; if (len == null)
this = new js.html.Float64Array( buffer, byteoffset, len ); this = new js.html.Float64Array( buffer, byteoffset );
else
this = new js.html.Float64Array( buffer, byteoffset, len );
} else { } else {
this = null; this = null;
} }

View File

@@ -8,7 +8,7 @@ package lime.utils;
from js.html.Int16Array from js.html.Int16Array
to js.html.Int16Array { to js.html.Int16Array {
public inline static var BYTES_PER_ELEMENT : Int = 2; public inline static var BYTES_PER_ELEMENT : Int = 2;
@:generic @:generic
public inline function new<T>( public inline function new<T>(
@@ -24,8 +24,10 @@ package lime.utils;
} else if(view != null) { } else if(view != null) {
this = new js.html.Int16Array( untyped view ); this = new js.html.Int16Array( untyped view );
} else if(buffer != null) { } else if(buffer != null) {
len = (len == null) ? untyped __js__('undefined') : len; if (len == null)
this = new js.html.Int16Array( buffer, byteoffset, len ); this = new js.html.Int16Array( buffer, byteoffset );
else
this = new js.html.Int16Array( buffer, byteoffset, len );
} else { } else {
this = null; this = null;
} }

View File

@@ -8,7 +8,7 @@ package lime.utils;
from js.html.Int32Array from js.html.Int32Array
to js.html.Int32Array { to js.html.Int32Array {
public inline static var BYTES_PER_ELEMENT : Int = 4; public inline static var BYTES_PER_ELEMENT : Int = 4;
@:generic @:generic
public inline function new<T>( public inline function new<T>(
@@ -24,8 +24,10 @@ package lime.utils;
} else if(view != null) { } else if(view != null) {
this = new js.html.Int32Array( untyped view ); this = new js.html.Int32Array( untyped view );
} else if(buffer != null) { } else if(buffer != null) {
len = (len == null) ? untyped __js__('undefined') : len; if (len == null)
this = new js.html.Int32Array( buffer, byteoffset, len ); this = new js.html.Int32Array( buffer, byteoffset );
else
this = new js.html.Int32Array( buffer, byteoffset, len );
} else { } else {
this = null; this = null;
} }

View File

@@ -8,7 +8,7 @@ package lime.utils;
from js.html.Int8Array from js.html.Int8Array
to js.html.Int8Array { to js.html.Int8Array {
public inline static var BYTES_PER_ELEMENT : Int = 1; public inline static var BYTES_PER_ELEMENT : Int = 1;
@:generic @:generic
public inline function new<T>( public inline function new<T>(
@@ -24,8 +24,10 @@ package lime.utils;
} else if(view != null) { } else if(view != null) {
this = new js.html.Int8Array( untyped view ); this = new js.html.Int8Array( untyped view );
} else if(buffer != null) { } else if(buffer != null) {
len = (len == null) ? untyped __js__('undefined') : len; if (len == null)
this = new js.html.Int8Array( buffer, byteoffset, len ); this = new js.html.Int8Array( buffer, byteoffset );
else
this = new js.html.Int8Array( buffer, byteoffset, len );
} else { } else {
this = null; this = null;
} }

View File

@@ -8,7 +8,7 @@ package lime.utils;
from js.html.Uint16Array from js.html.Uint16Array
to js.html.Uint16Array { to js.html.Uint16Array {
public inline static var BYTES_PER_ELEMENT : Int = 2; public inline static var BYTES_PER_ELEMENT : Int = 2;
@:generic @:generic
public inline function new<T>( public inline function new<T>(
@@ -24,8 +24,10 @@ package lime.utils;
} else if(view != null) { } else if(view != null) {
this = new js.html.Uint16Array( untyped view ); this = new js.html.Uint16Array( untyped view );
} else if(buffer != null) { } else if(buffer != null) {
len = (len == null) ? untyped __js__('undefined') : len; if (len == null)
this = new js.html.Uint16Array( buffer, byteoffset, len ); this = new js.html.Uint16Array( buffer, byteoffset );
else
this = new js.html.Uint16Array( buffer, byteoffset, len );
} else { } else {
this = null; this = null;
} }

View File

@@ -8,7 +8,7 @@ package lime.utils;
from js.html.Uint32Array from js.html.Uint32Array
to js.html.Uint32Array { to js.html.Uint32Array {
public inline static var BYTES_PER_ELEMENT : Int = 4; public inline static var BYTES_PER_ELEMENT : Int = 4;
@:generic @:generic
public inline function new<T>( public inline function new<T>(
@@ -24,8 +24,10 @@ package lime.utils;
} else if(view != null) { } else if(view != null) {
this = new js.html.Uint32Array( untyped view ); this = new js.html.Uint32Array( untyped view );
} else if(buffer != null) { } else if(buffer != null) {
len = (len == null) ? untyped __js__('undefined') : len; if (len == null)
this = new js.html.Uint32Array( buffer, byteoffset, len ); this = new js.html.Uint32Array( buffer, byteoffset );
else
this = new js.html.Uint32Array( buffer, byteoffset, len );
} else { } else {
this = null; this = null;
} }

View File

@@ -8,7 +8,7 @@ package lime.utils;
from js.html.Uint8Array from js.html.Uint8Array
to js.html.Uint8Array { to js.html.Uint8Array {
public inline static var BYTES_PER_ELEMENT : Int = 1; public inline static var BYTES_PER_ELEMENT : Int = 1;
@:generic @:generic
public inline function new<T>( public inline function new<T>(
@@ -24,8 +24,10 @@ package lime.utils;
} else if(view != null) { } else if(view != null) {
this = new js.html.Uint8Array( untyped view ); this = new js.html.Uint8Array( untyped view );
} else if(buffer != null) { } else if(buffer != null) {
len = (len == null) ? untyped __js__('undefined') : len; if (len == null)
this = new js.html.Uint8Array( buffer, byteoffset, len ); this = new js.html.Uint8Array( buffer, byteoffset );
else
this = new js.html.Uint8Array( buffer, byteoffset, len );
} else { } else {
this = null; this = null;
} }

View File

@@ -8,7 +8,7 @@ package lime.utils;
from js.html.Uint8ClampedArray from js.html.Uint8ClampedArray
to js.html.Uint8ClampedArray { to js.html.Uint8ClampedArray {
public inline static var BYTES_PER_ELEMENT : Int = 1; public inline static var BYTES_PER_ELEMENT : Int = 1;
@:generic @:generic
public inline function new<T>( public inline function new<T>(
@@ -24,8 +24,10 @@ package lime.utils;
} else if(view != null) { } else if(view != null) {
this = new js.html.Uint8ClampedArray( untyped view ); this = new js.html.Uint8ClampedArray( untyped view );
} else if(buffer != null) { } else if(buffer != null) {
len = (len == null) ? untyped __js__('undefined') : len; if (len == null)
this = new js.html.Uint8ClampedArray( buffer, byteoffset, len ); this = new js.html.Uint8ClampedArray( buffer, byteoffset );
else
this = new js.html.Uint8ClampedArray( buffer, byteoffset, len );
} else { } else {
this = null; this = null;
} }