Skip to content

Commit de686d0

Browse files
authored
fix color channel byte order in gfx/primitives.rs (#1522)
* fix color channel byte order: revert behavior change of #1470 * byte swap colors on big endian systems in gfx/primitives.rs
1 parent bc14e03 commit de686d0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sdl2/gfx/primitives.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub trait ToColor {
1717
#[inline]
1818
fn as_u32(&self) -> u32 {
1919
let (r, g, b, a) = self.as_rgba();
20-
u32::from_be_bytes([r, g, b, a])
20+
u32::from_le_bytes([r, g, b, a])
2121
}
2222
}
2323

@@ -39,7 +39,7 @@ impl ToColor for (u8, u8, u8, u8) {
3939
impl ToColor for u32 {
4040
#[inline]
4141
fn as_rgba(&self) -> (u8, u8, u8, u8) {
42-
let [r, g, b, a] = self.to_be_bytes();
42+
let [r, g, b, a] = self.to_le_bytes();
4343
(r, g, b, a)
4444
}
4545

0 commit comments

Comments
 (0)