xbm/parse: covert rgba to uint32 correctly

This commit is contained in:
Johan Malm 2020-08-11 21:20:38 +01:00
parent f635d834ee
commit f1b4aaa89f

View file

@ -16,9 +16,14 @@
/* TODO: should be window.active.button.unpressed.image.color */ /* TODO: should be window.active.button.unpressed.image.color */
static unsigned char defaultcolor[] = { 255, 255, 255, 255 }; static unsigned char defaultcolor[] = { 255, 255, 255, 255 };
static uint32_t u32(unsigned char *rbga) static uint32_t u32(unsigned char *rgba)
{ {
return (rbga[3] << 24) | (rbga[0] << 16) | (rbga[1] << 8) | rbga[0]; uint32_t ret = 0;
ret |= (rgba[3] & 0xff) << 24;
ret |= (rgba[2] & 0xff) << 16;
ret |= (rgba[1] & 0xff) << 8;
ret |= (rgba[0] & 0xff);
return ret;
} }
static void process_bytes(struct pixmap *pixmap, struct token *tokens) static void process_bytes(struct pixmap *pixmap, struct token *tokens)