wayland-rs icon indicating copy to clipboard operation
wayland-rs copied to clipboard

simple_window example endianness

Open Stargateur opened this issue 4 years ago • 1 comments

https://github.com/Smithay/wayland-rs/blob/e0b35a6f2bde7efec10eb1d51bfa194c62313672/wayland-client/examples/simple_window.rs#L55

simple_window example use u32::to_ne_bytes() that return the native endian representation array of the integer but the documentation of Argb8888 says:

Argb8888 32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian

Confirmed by official wayland doc about Argb8888:

argb8888 0 - 32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian

So, shouldn't the example on the contrary use u32::to_le_bytes() ?

Stargateur avatar Mar 28 '21 08:03 Stargateur

Good point, I guess I mixed up with the wayland wire format, which is specified to be native-endian. :sweat_smile:

elinorbgr avatar Mar 28 '21 13:03 elinorbgr