Fix ArrayBuffer from openfl.Vector on Neko
This commit is contained in:
@@ -14,6 +14,34 @@ typedef Int16Array = js.html.Int16Array;
|
|||||||
|
|
||||||
public function new #if !java <T> #end (bufferOrArray:#if !java T #else Dynamic #end, start:Int = 0, length:Null<Int> = null) {
|
public function new #if !java <T> #end (bufferOrArray:#if !java T #else Dynamic #end, start:Int = 0, length:Null<Int> = null) {
|
||||||
|
|
||||||
|
#if (openfl && neko && !lime_legacy)
|
||||||
|
if (Std.is (bufferOrArray, openfl.Vector.VectorData)) {
|
||||||
|
|
||||||
|
var vector:openfl.Vector<Int> = cast bufferOrArray;
|
||||||
|
var ints:Array<Int> = vector;
|
||||||
|
this.length = (length != null) ? length : ints.length - start;
|
||||||
|
|
||||||
|
super (this.length << 1);
|
||||||
|
|
||||||
|
#if !cpp
|
||||||
|
buffer.position = 0;
|
||||||
|
#end
|
||||||
|
|
||||||
|
for (i in 0...this.length) {
|
||||||
|
|
||||||
|
#if cpp
|
||||||
|
untyped __global__.__hxcpp_memory_set_i16 (bytes, (i << 1), ints[i + start]);
|
||||||
|
#else
|
||||||
|
buffer.writeShort (ints[i + start]);
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
if (Std.is (bufferOrArray, Int)) {
|
if (Std.is (bufferOrArray, Int)) {
|
||||||
|
|
||||||
super (Std.int (cast bufferOrArray) << 1);
|
super (Std.int (cast bufferOrArray) << 1);
|
||||||
|
|||||||
@@ -14,6 +14,34 @@ typedef Int32Array = js.html.Int32Array;
|
|||||||
|
|
||||||
public function new #if !java <T> #end (bufferOrArray:#if !java T #else Dynamic #end, start:Int = 0, length:Null<Int> = null) {
|
public function new #if !java <T> #end (bufferOrArray:#if !java T #else Dynamic #end, start:Int = 0, length:Null<Int> = null) {
|
||||||
|
|
||||||
|
#if (openfl && neko && !lime_legacy)
|
||||||
|
if (Std.is (bufferOrArray, openfl.Vector.VectorData)) {
|
||||||
|
|
||||||
|
var vector:openfl.Vector<Int> = cast bufferOrArray;
|
||||||
|
var ints:Array<Int> = vector;
|
||||||
|
this.length = (length != null) ? length : ints.length - start;
|
||||||
|
|
||||||
|
super (this.length << 2);
|
||||||
|
|
||||||
|
#if !cpp
|
||||||
|
buffer.position = 0;
|
||||||
|
#end
|
||||||
|
|
||||||
|
for (i in 0...this.length) {
|
||||||
|
|
||||||
|
#if cpp
|
||||||
|
untyped __global__.__hxcpp_memory_set_i32 (bytes, (i << 2), ints[i + start]);
|
||||||
|
#else
|
||||||
|
buffer.writeInt (ints[i + start]);
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
if (Std.is (bufferOrArray, Int)) {
|
if (Std.is (bufferOrArray, Int)) {
|
||||||
|
|
||||||
super (Std.int (cast bufferOrArray) << 2);
|
super (Std.int (cast bufferOrArray) << 2);
|
||||||
|
|||||||
@@ -14,6 +14,34 @@ typedef Int8Array = js.html.Int8Array;
|
|||||||
|
|
||||||
public function new #if !java <T> #end (bufferOrArray:#if !java T #else Dynamic #end, start:Int = 0, length:Null<Int> = null) {
|
public function new #if !java <T> #end (bufferOrArray:#if !java T #else Dynamic #end, start:Int = 0, length:Null<Int> = null) {
|
||||||
|
|
||||||
|
#if (openfl && neko && !lime_legacy)
|
||||||
|
if (Std.is (bufferOrArray, openfl.Vector.VectorData)) {
|
||||||
|
|
||||||
|
var vector:openfl.Vector<Int> = cast bufferOrArray;
|
||||||
|
var ints:Array<Int> = vector;
|
||||||
|
this.length = (length != null) ? length : ints.length - start;
|
||||||
|
|
||||||
|
super (this.length);
|
||||||
|
|
||||||
|
#if !cpp
|
||||||
|
buffer.position = 0;
|
||||||
|
#end
|
||||||
|
|
||||||
|
for (i in 0...this.length) {
|
||||||
|
|
||||||
|
#if cpp
|
||||||
|
untyped __global__.__hxcpp_memory_set_byte (bytes, i, ints[i + start]);
|
||||||
|
#else
|
||||||
|
buffer.writeByte (ints[i + start]);
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
if (Std.is (bufferOrArray, Int)) {
|
if (Std.is (bufferOrArray, Int)) {
|
||||||
|
|
||||||
super (Std.int (cast bufferOrArray));
|
super (Std.int (cast bufferOrArray));
|
||||||
|
|||||||
@@ -14,6 +14,34 @@ typedef UInt16Array = js.html.Uint16Array;
|
|||||||
|
|
||||||
public function new #if !java <T> #end (bufferOrArray:#if !java T #else Dynamic #end, start:Int = 0, length:Null<Int> = null) {
|
public function new #if !java <T> #end (bufferOrArray:#if !java T #else Dynamic #end, start:Int = 0, length:Null<Int> = null) {
|
||||||
|
|
||||||
|
#if (openfl && neko && !lime_legacy)
|
||||||
|
if (Std.is (bufferOrArray, openfl.Vector.VectorData)) {
|
||||||
|
|
||||||
|
var vector:openfl.Vector<Int> = cast bufferOrArray;
|
||||||
|
var ints:Array<Int> = vector;
|
||||||
|
this.length = (length != null) ? length : ints.length - start;
|
||||||
|
|
||||||
|
super (this.length << 1);
|
||||||
|
|
||||||
|
#if !cpp
|
||||||
|
buffer.position = 0;
|
||||||
|
#end
|
||||||
|
|
||||||
|
for (i in 0...this.length) {
|
||||||
|
|
||||||
|
#if cpp
|
||||||
|
untyped __global__.__hxcpp_memory_set_ui16 (bytes, (i << 1), ints[i + start]);
|
||||||
|
#else
|
||||||
|
buffer.writeShort (ints[i + start]);
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
if (Std.is (bufferOrArray, Int)) {
|
if (Std.is (bufferOrArray, Int)) {
|
||||||
|
|
||||||
super (Std.int (cast bufferOrArray) << 1);
|
super (Std.int (cast bufferOrArray) << 1);
|
||||||
|
|||||||
@@ -14,6 +14,34 @@ typedef UInt32Array = js.html.Uint32Array;
|
|||||||
|
|
||||||
public function new #if !java <T> #end (bufferOrArray:#if !java T #else Dynamic #end, start:Int = 0, length:Null<Int> = null) {
|
public function new #if !java <T> #end (bufferOrArray:#if !java T #else Dynamic #end, start:Int = 0, length:Null<Int> = null) {
|
||||||
|
|
||||||
|
#if (openfl && neko && !lime_legacy)
|
||||||
|
if (Std.is (bufferOrArray, openfl.Vector.VectorData)) {
|
||||||
|
|
||||||
|
var vector:openfl.Vector<Int> = cast bufferOrArray;
|
||||||
|
var ints:Array<Int> = vector;
|
||||||
|
this.length = (length != null) ? length : ints.length - start;
|
||||||
|
|
||||||
|
super (this.length << 2);
|
||||||
|
|
||||||
|
#if !cpp
|
||||||
|
buffer.position = 0;
|
||||||
|
#end
|
||||||
|
|
||||||
|
for (i in 0...this.length) {
|
||||||
|
|
||||||
|
#if cpp
|
||||||
|
untyped __global__.__hxcpp_memory_set_ui32 (bytes, (i << 2), ints[i + start]);
|
||||||
|
#else
|
||||||
|
buffer.writeInt (ints[i + start]);
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
if (Std.is (bufferOrArray, Int)) {
|
if (Std.is (bufferOrArray, Int)) {
|
||||||
|
|
||||||
super (Std.int (cast bufferOrArray) << 2);
|
super (Std.int (cast bufferOrArray) << 2);
|
||||||
|
|||||||
@@ -14,6 +14,34 @@ typedef UInt8Array = js.html.Uint8Array;
|
|||||||
|
|
||||||
public function new #if !java <T> #end (bufferOrArray:#if !java T #else Dynamic #end, start:Int = 0, length:Null<Int> = null) {
|
public function new #if !java <T> #end (bufferOrArray:#if !java T #else Dynamic #end, start:Int = 0, length:Null<Int> = null) {
|
||||||
|
|
||||||
|
#if (openfl && neko && !lime_legacy)
|
||||||
|
if (Std.is (bufferOrArray, openfl.Vector.VectorData)) {
|
||||||
|
|
||||||
|
var vector:openfl.Vector<Int> = cast bufferOrArray;
|
||||||
|
var ints:Array<Int> = vector;
|
||||||
|
this.length = (length != null) ? length : ints.length - start;
|
||||||
|
|
||||||
|
super (this.length);
|
||||||
|
|
||||||
|
#if !cpp
|
||||||
|
buffer.position = 0;
|
||||||
|
#end
|
||||||
|
|
||||||
|
for (i in 0...this.length) {
|
||||||
|
|
||||||
|
#if cpp
|
||||||
|
untyped __global__.__hxcpp_memory_set_byte (bytes, i, ints[i + start]);
|
||||||
|
#else
|
||||||
|
buffer.writeByte (ints[i + start]);
|
||||||
|
#end
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
if (Std.is (bufferOrArray, Int)) {
|
if (Std.is (bufferOrArray, Int)) {
|
||||||
|
|
||||||
super (Std.int (cast bufferOrArray));
|
super (Std.int (cast bufferOrArray));
|
||||||
|
|||||||
Reference in New Issue
Block a user