File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ impl futures::stream::Stream for CursorStream {
67
67
width,
68
68
height,
69
69
width * 4 ,
70
- wl_shm:: Format :: Abgr8888 ,
70
+ wl_shm:: Format :: Argb8888 ,
71
71
) ;
72
72
* buffer = Some ( ( width, height, fd, wl_buffer) ) ;
73
73
* state = State :: WaitingForFormats ; // XXX, well, not waiting
@@ -81,7 +81,12 @@ impl futures::stream::Stream for CursorStream {
81
81
let ( width, height, fd, _) = & buffer. as_ref ( ) . unwrap ( ) ;
82
82
// XXX unwrap
83
83
let mmap = unsafe { memmap2:: Mmap :: map ( fd) . unwrap ( ) } ;
84
- let image = image:: RgbaImage :: from_vec ( * width, * height, mmap. to_vec ( ) ) ;
84
+ let mut bytes = mmap. to_vec ( ) ;
85
+ // Swap BGRA to RGBA
86
+ for pixel in bytes. chunks_mut ( 4 ) {
87
+ pixel. swap ( 2 , 0 ) ;
88
+ }
89
+ let image = image:: RgbaImage :: from_vec ( * width, * height, bytes) ;
85
90
return Poll :: Ready ( image) ;
86
91
}
87
92
// XXX Ignore error
You can’t perform that action at this time.
0 commit comments