Accept more sensible arguments in affine_matrix

This commit is contained in:
Gwilym Kuiper 2021-06-05 20:25:47 +01:00
parent 361e9c93e6
commit e7edaa1a27

View file

@ -1,4 +1,5 @@
use crate::display::object::AffineMatrixAttributes; use crate::display::object::AffineMatrixAttributes;
use crate::number::Num;
#[allow(non_snake_case)] #[allow(non_snake_case)]
@ -105,7 +106,7 @@ pub fn arc_tan2(x: i16, y: i32) -> i16 {
result result
} }
pub fn affine_matrix(x_scale: i16, y_scale: i16, rotation: u16) -> AffineMatrixAttributes { pub fn affine_matrix(x_scale: Num<8>, y_scale: Num<8>, rotation: u8) -> AffineMatrixAttributes {
let mut result = AffineMatrixAttributes { let mut result = AffineMatrixAttributes {
p_a: 0, p_a: 0,
p_b: 0, p_b: 0,
@ -120,10 +121,12 @@ pub fn affine_matrix(x_scale: i16, y_scale: i16, rotation: u16) -> AffineMatrixA
rotation: u16, rotation: u16,
} }
let rotation_for_input = (rotation as u16) << 8;
let input = Input { let input = Input {
x_scale, y_scale: x_scale.to_raw() as i16,
y_scale, x_scale: y_scale.to_raw() as i16,
rotation, rotation: rotation_for_input,
}; };
unsafe { unsafe {