Skip to content

Commit

Permalink
Add missing x frame offset (#85)
Browse files Browse the repository at this point in the history
Fixes: #84
  • Loading branch information
sophie-h authored Jul 31, 2024
1 parent 59a7663 commit 56c4b49
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/extended.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,18 @@ pub(crate) fn composite_frame(
} else if frame_has_alpha {
for y in 0..height {
let frame_index = (y * frame_width as usize) * 4;
let canvas_index = (y + frame_offset_y as usize) * canvas_width as usize * 4;
let canvas_index = (frame_offset_x as usize
+ (y + frame_offset_y as usize) * canvas_width as usize)
* 4;

canvas[canvas_index..][..width * 4].copy_from_slice(&frame[frame_index..][..width * 4]);
}
} else {
for y in 0..height {
let index = (y * frame_width as usize) * 3;
let canvas_index = (y + frame_offset_y as usize) * canvas_width as usize * 4;

let canvas_index = (frame_offset_x as usize
+ (y + frame_offset_y as usize) * canvas_width as usize)
* 4;
let input = &frame[index..][..width * 3];
let output = &mut canvas[canvas_index..][..width * 4];

Expand Down

0 comments on commit 56c4b49

Please sign in to comment.