Skip to content

Commit 53cdba9

Browse files
committed
avm2: Convert flash.geom.Matrix to ActionScript
I've kept the rust `flash.geom` module, even though it's now empty, since we'll need to add things like `flash.geom.Transform` native methods in the future.
1 parent 48e4d80 commit 53cdba9

File tree

5 files changed

+34
-194
lines changed

5 files changed

+34
-194
lines changed

core/src/avm2/globals.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,6 @@ pub fn load_player_globals<'gc>(
819819
)?;
820820

821821
// package `flash.geom`
822-
class(activation, flash::geom::matrix::create_class(mc), script)?;
823822

824823
// package `flash.media`
825824
avm2_system_class!(
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
//! `flash.geom` namespace
2-
3-
pub mod matrix;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package flash.geom {
2+
public class Matrix {
3+
public var a:Number;
4+
public var b:Number;
5+
public var c:Number;
6+
public var d:Number;
7+
public var tx:Number;
8+
public var ty:Number;
9+
10+
public function Matrix(a:Number = 1, b:Number = 0, c:Number = 0, d:Number = 1, tx:Number = 0, ty:Number = 0) {
11+
this.a = a;
12+
this.b = b;
13+
this.c = c;
14+
this.d = d;
15+
this.tx = tx;
16+
this.ty = ty;
17+
}
18+
19+
public function identity():void {
20+
this.a = 1;
21+
this.b = 0;
22+
this.c = 0;
23+
this.d = 1;
24+
this.tx = 0;
25+
this.ty = 0;
26+
}
27+
28+
public function scale(sx:Number, sy:Number):void {
29+
this.a *= sx;
30+
this.d *= sy;
31+
}
32+
}
33+
}

core/src/avm2/globals/flash/geom/matrix.rs

Lines changed: 0 additions & 191 deletions
This file was deleted.

core/src/avm2/globals/globals.as

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ include "flash/display/SWFVersion.as"
3030
include "flash/display/TriangleCulling.as"
3131
include "flash/geom/ColorTransform.as"
3232
include "flash/geom/Orientation3D.as"
33+
include "flash/geom/Matrix.as"
3334
include "flash/geom/Point.as"
3435
include "flash/geom/Rectangle.as"
3536
include "flash/net/SharedObjectFlushStatus.as"

0 commit comments

Comments
 (0)