Skip to content

Commit

Permalink
Fixed a bug where exported sheets were larger than needed
Browse files Browse the repository at this point in the history
  • Loading branch information
agersant committed Dec 3, 2022
1 parent 1de03fb commit 9c81709
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src-tauri/src/export/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ pub(super) fn pack_sheet(
h: bitmap.height() as usize,
rot: crunch::Rotation::None,
});
let (size, _, layout) = crunch::pack_into_po2(8_192, items).map_err(|_| PackError::Packing)?;
let (width, height, layout) =
crunch::pack_into_po2(8_192, items).map_err(|_| PackError::Packing)?;
let layout = layout
.into_iter()
.map(|(r, p)| {
Expand All @@ -73,7 +74,7 @@ pub(super) fn pack_sheet(
})
.collect::<HashMap<_, _>>();

let mut texture = DynamicImage::new_rgba8(size as u32, size as u32);
let mut texture = DynamicImage::new_rgba8(width as u32, height as u32);
layout.iter().for_each(|(path, frame)| {
let bitmap = bitmaps.get(path.as_path()).unwrap();
let (x, y) = (frame.position_in_sheet.0, frame.position_in_sheet.1);
Expand Down

0 comments on commit 9c81709

Please sign in to comment.