]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xbm/parse: covert rgba to uint32 correctly
authorJohan Malm <jgm323@gmail.com>
Tue, 11 Aug 2020 20:20:38 +0000 (21:20 +0100)
committerJohan Malm <jgm323@gmail.com>
Tue, 11 Aug 2020 20:20:38 +0000 (21:20 +0100)
src/theme/xbm/parse.c

index a48230728f7b0c95d8d90ac79c180529b7dd07da..c395fbf0077d75b078c71dbc7be639934e4c226b 100644 (file)
 /* TODO: should be window.active.button.unpressed.image.color */
 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)