Fix text_box red and blue channels being swapped

This commit is contained in:
Jeremy Soller 2023-11-28 10:43:15 -07:00
parent 3b8254020f
commit 94fe82f38e
No known key found for this signature in database
GPG key ID: DCFCA852D3906975

View file

@ -344,7 +344,13 @@ where
&mut SWASH_CACHE.lock().unwrap(),
text_color,
|x, y, w, h, color| {
draw_rect(buffer, image_w, image_h, x, y, w as i32, h as i32, color.0);
// Grab alpha channel and green channel
let mut image_color = color.0 & 0xFF00FF00;
// Shift red channel
image_color |= (color.0 & 0x00FF0000) >> 16;
// Shift blue channel
image_color |= (color.0 & 0x000000FF) << 16;
draw_rect(buffer, image_w, image_h, x, y, w as i32, h as i32, image_color);
},
);