Skip to content

Commit

Permalink
Call outline.bounds directly instead of making a custom union routine
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper-Bekkers committed Nov 18, 2022
1 parent 4e7ea80 commit 5d21921
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/scale/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -890,18 +890,7 @@ impl<'a> Render<'a> {
}
let palette = proxy.color.palette(font, *palette_index);

let mut total_bounds = zeno::Bounds::empty();

for i in 0..outline.len() {
let layer = match outline.get(i) {
Some(layer) => layer,
_ => {
break;
}
};
let bounds = layer.bounds();
total_bounds = total_bounds.grow(&bounds);
}
let total_bounds = outline.bounds();

let base_x = total_bounds.min.x.floor() as i32;
let base_y = total_bounds.min.y.floor() as i32;
Expand All @@ -910,7 +899,7 @@ impl<'a> Render<'a> {

image.data.resize((base_w * base_h * 4) as usize, 0);
image.placement.left = base_x;
image.placement.top = (base_h as i32 + base_y);
image.placement.top = base_h as i32 + base_y;
image.placement.width = total_bounds.width().ceil() as u32;
image.placement.height = total_bounds.height().ceil() as u32;

Expand Down

0 comments on commit 5d21921

Please sign in to comment.