Fix rgba ordering

This commit is contained in:
Jeremy Soller 2022-10-27 18:16:42 -06:00
parent cb7ec05d76
commit a4a4eb7783
No known key found for this signature in database
GPG key ID: 87F211AF2BE4C2FE
2 changed files with 6 additions and 6 deletions

View file

@ -281,9 +281,9 @@ where
let offset = offset_y + x as usize * 4;
let mut current =
pixels[offset + 2] as u32 |
pixels[offset] as u32 |
(pixels[offset + 1] as u32) << 8 |
(pixels[offset] as u32) << 16 |
(pixels[offset + 2] as u32) << 16 |
(pixels[offset + 3] as u32) << 24;
if alpha >= 255 || current == 0 {
@ -298,9 +298,9 @@ where
current = (rb & 0x00FF00FF) | (ag & 0xFF00FF00);
}
pixels[offset + 2] = current as u8;
pixels[offset] = current as u8;
pixels[offset + 1] = (current >> 8) as u8;
pixels[offset] = (current >> 16) as u8;
pixels[offset + 2] = (current >> 16) as u8;
pixels[offset + 3] = (current >> 24) as u8;
}
}

View file

@ -114,9 +114,9 @@ impl<'a> SwashCache<'a> {
x + off_x,
y + off_y,
Color::rgba(
image.data[i + 2],
image.data[i + 1],
image.data[i],
image.data[i + 1],
image.data[i + 2],
image.data[i + 3]
)
);