From faed7b456f2448103089fd50c837027178d6be72 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sat, 8 Oct 2022 17:12:50 +0100 Subject: [PATCH] Avoid double transforming --- agb/src/display/tiled/map.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/agb/src/display/tiled/map.rs b/agb/src/display/tiled/map.rs index deb37d83..9abe79a8 100644 --- a/agb/src/display/tiled/map.rs +++ b/agb/src/display/tiled/map.rs @@ -245,7 +245,6 @@ pub struct AffineMap { scroll: Vector2D, - transform_origin: Vector2D>, transform: BgAffineSetData, tiles: Vec, @@ -279,7 +278,7 @@ impl TiledMapPrivate for AffineMap { self.size } fn update_bg_registers(&self) { - let register_pos = self.transform.position + self.transform_origin; + let register_pos = self.transform.position; self.bg_x().set(register_pos.x); self.bg_y().set(register_pos.y); self.bg_affine_matrix().set(self.transform.matrix); @@ -307,7 +306,6 @@ impl AffineMap { scroll: Default::default(), - transform_origin: Default::default(), transform: Default::default(), tiles: vec![Default::default(); size.num_tiles()], @@ -353,11 +351,10 @@ impl AffineMap { scale: impl Into>>, rotation: impl Into>, ) { - self.transform_origin = transform_origin.into(); let scale = scale.into(); let rotation = rotation.into(); self.transform = - crate::syscall::bg_affine_matrix(self.transform_origin, self.scroll, scale, rotation); + crate::syscall::bg_affine_matrix(transform_origin.into(), self.scroll, scale, rotation); } fn bg_x(&self) -> MemoryMapped> {