Write image buffer backwards

This commit is contained in:
2025-07-14 18:05:15 +02:00
parent d55f82ed1e
commit c7decddcc9

View File

@ -70,7 +70,7 @@ fn load_wallpaper(path: &Path) -> eyre::Result<GrayAlphaImage> {
match image_dimensions {
(SCREEN_W, SCREEN_H) => {}
(SCREEN_H, SCREEN_W) => image = image.rotate90().flipv(),
(SCREEN_H, SCREEN_W) => image = image.rotate270(),
_ => bail!("Image must be {SCREEN_W}x{SCREEN_H}"),
}
@ -119,7 +119,7 @@ fn image_to_offimage_buffer(image: GrayAlphaImage) -> eyre::Result<Box<[u8; IOCT
);
// Iterate over pixels and copy them into `buf`.
for (i, pixel) in image.chunks_exact(2).enumerate() {
for (i, pixel) in (0..buf.len()).rev().zip(image.chunks_exact(2)) {
let &[gray, alpha] = pixel else {
unreachable!()
};