From cfbb110b60eb73bb71657be68d55f5be26de6d73 Mon Sep 17 00:00:00 2001 From: Lord-McSweeney Date: Tue, 21 Jan 2025 21:53:24 -0800 Subject: [PATCH] avm2: Use NativeCallable in Context3D code --- core/src/avm2/globals/flash/display3D/context_3d.rs | 5 +++-- core/src/avm2/globals/flash/geom/Matrix3D.as | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/avm2/globals/flash/display3D/context_3d.rs b/core/src/avm2/globals/flash/display3D/context_3d.rs index d07c8b295341..3614e840d7d1 100644 --- a/core/src/avm2/globals/flash/display3D/context_3d.rs +++ b/core/src/avm2/globals/flash/display3D/context_3d.rs @@ -1,4 +1,5 @@ use crate::avm2::error::{argument_error, error, make_error_2008}; +use crate::avm2::globals::methods::flash_geom_matrix_3d as matrix3d_methods; use crate::avm2::globals::slots::flash_geom_matrix_3d as matrix3d_slots; use crate::avm2::globals::slots::flash_geom_rectangle as rectangle_slots; use crate::avm2::parameters::ParametersExt; @@ -321,11 +322,11 @@ pub fn set_program_constants_from_matrix<'gc>( // See https://github.com/openfl/openfl/blob/971a4c9e43b5472fd84d73920a2b7c1b3d8d9257/src/openfl/display3D/Context3D.hx#L1532-L1550 if user_transposed_matrix { matrix = Value::from(matrix) - .call_public_property("clone", &[], activation)? + .call_method(matrix3d_methods::CLONE, &[], activation)? .as_object() .expect("Matrix3D.clone returns Object"); - Value::from(matrix).call_public_property("transpose", &[], activation)?; + Value::from(matrix).call_method(matrix3d_methods::TRANSPOSE, &[], activation)?; } let matrix_raw_data = matrix diff --git a/core/src/avm2/globals/flash/geom/Matrix3D.as b/core/src/avm2/globals/flash/geom/Matrix3D.as index 5bd485a217c1..94a40d69f942 100644 --- a/core/src/avm2/globals/flash/geom/Matrix3D.as +++ b/core/src/avm2/globals/flash/geom/Matrix3D.as @@ -221,6 +221,7 @@ package flash.geom { } } + [Ruffle(NativeCallable)] public function transpose():void { // Make a copy var oRawData = this._rawData.AS3::concat(); @@ -237,6 +238,7 @@ package flash.geom { this._rawData[13] = oRawData[7]; this._rawData[14] = oRawData[11]; } + public function append(lhs:Matrix3D):void { var m111:Number = this._rawData[0], m121:Number = this._rawData[4], @@ -403,6 +405,7 @@ package flash.geom { } } + [Ruffle(NativeCallable)] public function clone():Matrix3D { return new Matrix3D(this.rawData); }