Skip to content

Commit

Permalink
avm2: Add missing [API()] to flash.geom
Browse files Browse the repository at this point in the history
  • Loading branch information
MartySVK authored and torokati44 committed Aug 15, 2024
1 parent b33423c commit 24478ff
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/src/avm2/globals/flash/geom/Matrix.as
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ package flash.geom {
this.ty = ty;
}

[API("674")]
public function copyColumnFrom(column:uint, vector3D:Vector3D):void {
// FP BUG: For some reason these methods are identical
this.copyRowFrom(column, vector3D);
}

[API("674")]
public function copyColumnTo(column:uint, vector3D:Vector3D):void {
if(column == 0) {
vector3D.x = this.a;
Expand All @@ -59,6 +61,7 @@ package flash.geom {
} // otherwise vector is unchanged
}

[API("674")]
public function copyFrom(sourceMatrix: Matrix): void {
this.a = sourceMatrix.a;
this.b = sourceMatrix.b;
Expand All @@ -68,6 +71,7 @@ package flash.geom {
this.ty = sourceMatrix.ty;
}

[API("674")]
public function copyRowFrom(row: uint, vector3D: Vector3D): void {
if (row == 0) {
this.a = vector3D.x;
Expand All @@ -80,6 +84,7 @@ package flash.geom {
} // otherwise matrix is unchanged
}

[API("674")]
public function copyRowTo(row:uint, vector3D:Vector3D):void {
if(row == 0) {
vector3D.x = this.a;
Expand Down Expand Up @@ -167,6 +172,7 @@ package flash.geom {
this.ty *= sy;
}

[API("674")]
public function setTo(aa:Number, ba:Number, ca:Number, da:Number, txa:Number, tya:Number):void {
this.a = aa;
this.b = ba;
Expand Down
7 changes: 7 additions & 0 deletions core/src/avm2/globals/flash/geom/Matrix3D.as
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ package flash.geom {
this.append(m);
}

[API("674")]
public function copyRawDataFrom(vector:Vector.<Number>, index:uint = 0, transpose:Boolean = false):void {
if (transpose) {
this.transpose();
Expand All @@ -107,6 +108,7 @@ package flash.geom {
}

// Based on https://github.com/openfl/openfl/blob/develop/src/openfl/geom/Matrix3D.hx#L542C1-L573
[API("674")]
public function copyRowTo(row:uint, vector3D:Vector3D):void {
if (row > 3) {
throw new ArgumentError("Error #2004: One of the parameters is invalid.", 2004);
Expand Down Expand Up @@ -141,6 +143,7 @@ package flash.geom {
}

// Based on https://github.com/openfl/openfl/blob/develop/src/openfl/geom/Matrix3D.hx#L504-L534
[API("674")]
public function copyRowFrom(row:uint, vector3D:Vector3D):void {
if (row > 3) {
throw new ArgumentError("Error #2004: One of the parameters is invalid.", 2004);
Expand Down Expand Up @@ -377,11 +380,13 @@ package flash.geom {
this.prepend(m);
}

[API("674")]
public function copyFrom(other:Matrix3D):void {
// This makes a copy of other.rawData
this._rawData = other.rawData;
}

[API("674")]
public function copyRawDataTo(vector:Vector.<Number>, index:uint = 0, transpose:Boolean = false):void {
if (transpose) {
this.transpose();
Expand Down Expand Up @@ -502,6 +507,7 @@ package flash.geom {
return !(components[2].x == 0 || components[2].y == 0 || components[2].y == 0);
}

[API("674")]
public function copyColumnTo(column:uint, vector3D:Vector3D):void {
if (column > 3) {
throw new ArgumentError("Error #2004: One of the parameters is invalid.", 2004);
Expand Down Expand Up @@ -537,6 +543,7 @@ package flash.geom {
}
}

[API("674")]
public function copyColumnFrom(column:uint, vector3D:Vector3D):void {
if (column > 3) {
throw new ArgumentError("Error #2004: One of the parameters is invalid.", 2004);
Expand Down
2 changes: 2 additions & 0 deletions core/src/avm2/globals/flash/geom/Point.as
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ package flash.geom {
return new Point(this.x, this.y);
}

[API("674")]
public function copyFrom(sourcePoint:Point):void {
this.x = sourcePoint.x;
this.y = sourcePoint.y;
Expand All @@ -51,6 +52,7 @@ package flash.geom {
this.y += dy;
}

[API("674")]
public function setTo(xa:Number, ya:Number):void {
this.x = xa;
this.y = ya;
Expand Down
1 change: 1 addition & 0 deletions core/src/avm2/globals/flash/geom/Rectangle.as
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ package flash.geom {
this.height = sourceRect.height;
}

[API("674")]
public function setTo(xa: Number, ya: Number, widtha: Number, heighta: Number): void {
this.x = xa;
this.y = ya;
Expand Down
2 changes: 2 additions & 0 deletions core/src/avm2/globals/flash/geom/Vector3D.as
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ package flash.geom {
return new Vector3D(this.x, this.y, this.z, this.w);
}

[API("674")]
public function copyFrom(sourceVector3D:Vector3D):void {
this.x = sourceVector3D.x;
this.y = sourceVector3D.y;
Expand All @@ -87,6 +88,7 @@ package flash.geom {
&& (!allFour || Math.abs(toCompare.w) < tolerance); // FP BUG
}

[API("674")]
public function setTo(xa:Number, ya:Number, za: Number):void {
this.x = xa;
this.y = ya;
Expand Down

0 comments on commit 24478ff

Please sign in to comment.