From b4f6113cb975110c33f607aa39d19290f58be398 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Thu, 24 Sep 2009 07:48:46 -0400 Subject: [PATCH] Fix bugs in a1b2g1r1. The first bug is that it is treating the input as if it were a1r1g1b1; the second one is that the red channel should only be shifted two bits, not three. --- pixman/pixman-access.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c index 06b8411..0a48451 100644 --- a/pixman/pixman-access.c +++ b/pixman/pixman-access.c @@ -942,16 +942,16 @@ fetch_scanline_a1r1g1b1 (pixman_image_t *image, uint32_t a, r, g, b; const uint32_t *bits = image->bits.bits + y * image->bits.rowstride; int i; - + for (i = 0; i < width; ++i) { uint32_t p = FETCH_4 (image, bits, i + x); - + a = ((p & 0x8) * 0xff) << 21; r = ((p & 0x4) * 0xff) << 14; g = ((p & 0x2) * 0xff) << 7; b = ((p & 0x1) * 0xff); - + *buffer++ = a | r | g | b; } } @@ -974,10 +974,10 @@ fetch_scanline_a1b1g1r1 (pixman_image_t *image, uint32_t a, r, g, b; a = ((p & 0x8) * 0xff) << 21; - r = ((p & 0x4) * 0xff) >> 3; + b = ((p & 0x4) * 0xff) >> 2; g = ((p & 0x2) * 0xff) << 7; - b = ((p & 0x1) * 0xff) << 16; - + r = ((p & 0x1) * 0xff) << 16; + *buffer++ = a | r | g | b; } } @@ -1676,12 +1676,12 @@ fetch_pixel_a1r1g1b1 (bits_image_t *image, uint32_t *bits = image->bits + line * image->rowstride; uint32_t pixel = FETCH_4 (image, bits, offset); uint32_t a, r, g, b; - + a = ((pixel & 0x8) * 0xff) << 21; r = ((pixel & 0x4) * 0xff) << 14; g = ((pixel & 0x2) * 0xff) << 7; b = ((pixel & 0x1) * 0xff); - + return a | r | g | b; } @@ -1695,10 +1695,10 @@ fetch_pixel_a1b1g1r1 (bits_image_t *image, uint32_t a, r, g, b; a = ((pixel & 0x8) * 0xff) << 21; - r = ((pixel & 0x4) * 0xff) >> 3; + b = ((pixel & 0x4) * 0xff) >> 2; g = ((pixel & 0x2) * 0xff) << 7; - b = ((pixel & 0x1) * 0xff) << 16; - + r = ((pixel & 0x1) * 0xff) << 16; + return a | r | g | b; } -- 2.7.4