From adce5170ee2af97f29331b2627920c4c22e3b9c6 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sat, 12 Feb 2022 13:28:15 +0000 Subject: [PATCH] examples: draw: Handle different endianness for cursor colour --- examples/draw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/draw.c b/examples/draw.c index a130b8a..d888487 100644 --- a/examples/draw.c +++ b/examples/draw.c @@ -96,7 +96,12 @@ static struct nvnc_fb* create_cursor() struct nvnc_fb* fb = nvnc_fb_new(32, 32, DRM_FORMAT_RGBA8888, 32); assert(fb); - uint32_t colour = 0x0000ffff; +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + uint32_t colour = 0x00ff00ffULL; +#else + uint32_t colour = 0xff00ff00ULL; +#endif + uint32_t* pixels = nvnc_fb_get_addr(fb); for (int i = 0; i < 32 * 32; ++i) {