Validate array length when converting to Matrix3.
This commit is contained in:
@@ -22,7 +22,7 @@ import lime.utils.Float32Array;
|
|||||||
@:fileXml('tags="haxe,release"')
|
@:fileXml('tags="haxe,release"')
|
||||||
@:noDebug
|
@:noDebug
|
||||||
#end
|
#end
|
||||||
abstract Matrix3(Float32Array) from Float32Array to Float32Array
|
abstract Matrix3(Float32Array) to Float32Array
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
The matrix a component, used in scaling and skewing (default is 1)
|
The matrix a component, used in scaling and skewing (default is 1)
|
||||||
@@ -335,6 +335,16 @@ abstract Matrix3(Float32Array) from Float32Array to Float32Array
|
|||||||
return new Matrix3(matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty);
|
return new Matrix3(matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@:from private static inline function fromFloat32Array(array:Float32Array):Matrix3
|
||||||
|
{
|
||||||
|
if (array.length != 9)
|
||||||
|
{
|
||||||
|
throw "Expected array of length 9, got " + array.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cast array;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Resets the matrix to default identity values
|
Resets the matrix to default identity values
|
||||||
**/
|
**/
|
||||||
|
|||||||
Reference in New Issue
Block a user