swap GL frames to bgra

This commit is contained in:
Lily Tsuru 2024-08-05 09:01:54 -04:00
parent b972478ee9
commit 571ed740dd

View file

@ -132,6 +132,16 @@ impl RfbServer {
&mut self.framebuffer[dest_line_off..dest_line_off + self.width as usize];
dest_slice.copy_from_slice(scanlines[y as usize]);
// swap scanline to BGRA (compatibility hack. Should make this optional!)
for pix in dest_slice {
let a = ((*pix & 0xff000000) >> 24);
let b = ((*pix & 0x00ff0000) >> 16);
let g = ((*pix & 0x0000ff00) >> 8);
let r = (*pix & 0x000000ff);
*pix = a << 24 | r << 16 | g << 8 | b;
}
}
} else {
for y in 0..self.height {