Write image buffer backwards
This commit is contained in:
@ -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!()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user