remove unnecessary Tile clone

This commit is contained in:
nworbnhoj 2022-06-17 23:22:29 +10:00
parent d33d7958f2
commit d75c333888

View file

@ -210,7 +210,7 @@ impl Modals {
let portrait_scale = (modal_width / img_width).min(modal_height / img_height); let portrait_scale = (modal_width / img_width).min(modal_height / img_height);
let landscape_scale = (modal_width / img_height).min(modal_height / img_width); let landscape_scale = (modal_width / img_height).min(modal_height / img_width);
let bm = if portrait_scale >= 1.0 { let mut bm = if portrait_scale >= 1.0 {
Bitmap::from(img) Bitmap::from(img)
} else if landscape_scale >= 1.0 { } else if landscape_scale >= 1.0 {
Bitmap::from(img).rotate90() Bitmap::from(img).rotate90()
@ -229,16 +229,15 @@ impl Modals {
let center = Point::new( let center = Point::new(
((Modals::MODAL_WIDTH - bm_width) / 2).try_into().unwrap(), ((Modals::MODAL_WIDTH - bm_width) / 2).try_into().unwrap(),
((Modals::MODAL_HEIGHT - bm_height) / 2).try_into().unwrap(), ((Modals::MODAL_HEIGHT - bm_height) / 2).try_into().unwrap(),
); );
bm.translate(center);
let mut tiles: [Option<Tile>; 6] = [None; 6]; let mut tiles: [Option<Tile>; 6] = [None; 6];
for (t, tile) in bm.iter().enumerate() { for (t, tile) in bm.iter().enumerate() {
if t >= tiles.len() { if t >= tiles.len() {
continue; continue;
} }
let mut copy = tile.clone(); tiles[t] = Some(*tile);
copy.translate(center);
tiles[t] = Some(copy);
} }
let spec = ManagedImage { let spec = ManagedImage {