Skip to content

Commit 8f05026

Browse files
committed
hopefully fix endianness, again
1 parent 6d8703c commit 8f05026

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/alpha_blending.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
//!
33
//! https://github.com/webmproject/libwebp/blob/e4f7a9f0c7c9fbfae1568bc7fa5c94b989b50872/src/demux/anim_decode.c#L215-L267
44
5-
#[cfg(target_endian = "big")]
6-
fn channel_shift(i: u32) -> u32 {
7-
24 - (i) * 8
8-
}
9-
10-
#[cfg(target_endian = "little")]
115
fn channel_shift(i: u32) -> u32 {
126
i * 8
137
}
@@ -61,7 +55,7 @@ fn blend_pixel_nonpremult(src: u32, dst: u32) -> u32 {
6155
}
6256

6357
pub(crate) fn do_alpha_blending(buffer: [u8; 4], canvas: [u8; 4]) -> [u8; 4] {
64-
blend_pixel_nonpremult(u32::from_ne_bytes(buffer), u32::from_ne_bytes(canvas)).to_ne_bytes()
58+
blend_pixel_nonpremult(u32::from_le_bytes(buffer), u32::from_le_bytes(canvas)).to_le_bytes()
6559
}
6660

6761
/// Divides by 255, rounding to nearest (as opposed to down, like regular integer division does).

0 commit comments

Comments
 (0)