Skip to content

Commit 9e68467

Browse files
committed
fix tiling step
1 parent 2f332cb commit 9e68467

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/host/graphics.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -532,13 +532,12 @@ pub(crate) fn draw_sub_tile(
532532
return;
533533
}
534534

535-
if !(w as u32).is_multiple_of(width) {
536-
state.log_error("area width must be a multiple of image width");
535+
if !(w as u32).is_multiple_of(sub_width) {
536+
state.log_error("area width must be a multiple of sib-image width");
537537
return;
538538
}
539-
let height = image_bytes.len() as u32 / (width / 2);
540-
if !(h as u32).is_multiple_of(height) {
541-
state.log_error("area width must be a multiple of image width");
539+
if !(h as u32).is_multiple_of(sub_height) {
540+
state.log_error("area width must be a multiple of sub-image height");
542541
return;
543542
}
544543

@@ -559,8 +558,8 @@ pub(crate) fn draw_sub_tile(
559558
sub: Some(sub),
560559
};
561560

562-
for px in x..x + w {
563-
for py in y..y + h {
561+
for px in (x..x + w).step_by(sub_width as _) {
562+
for py in (y..y + h).step_by(sub_height as _) {
564563
let point = Point::new(px, py);
565564
image.render(point, &mut state.frame);
566565
}

0 commit comments

Comments
 (0)