summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2009-10-09 16:08:15 -0700
committerMichel Dänzer <michel@daenzer.net>2009-10-10 12:19:57 +0200
commit2e37bda8d6b0203973893d8440d9917975f53d97 (patch)
tree25355177e122ee175a2643062f725b74300e7d88
parent6d99a7de3f2c60bf90faf604b1a39d4aa5bdfd09 (diff)
EXA: fix exaGetRGBAFromPixel to not loop forever on PICT_a8 picture
Easily reproducible by running "rendercheck -t fill". It should be safe to just test against rbits for all colour components as we should always have values for r/g/bbits for PICT_FORMAT_COLOR formats. Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Michel Dänzer <daenzer@vmware Signed-off-by: Keith Packard <keithp@keithp.com> (cherry picked from commit 55305cf8db7787883bc80b7348eb626e609626f8)
-rw-r--r--exa/exa_render.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/exa/exa_render.c b/exa/exa_render.c
index 1c1856610..70701a2b3 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -204,22 +204,28 @@ exaGetRGBAFromPixel(CARD32 pixel,
bshift = pFormat->direct.blue;
ashift = pFormat->direct.alpha;
- *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
- while (rbits < 16) {
- *red |= *red >> rbits;
- rbits <<= 1;
- }
+ if (rbits) {
+ *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
+ while (rbits < 16) {
+ *red |= *red >> rbits;
+ rbits <<= 1;
+ }
- *green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits);
- while (gbits < 16) {
- *green |= *green >> gbits;
- gbits <<= 1;
- }
+ *green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits);
+ while (gbits < 16) {
+ *green |= *green >> gbits;
+ gbits <<= 1;
+ }
- *blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits);
- while (bbits < 16) {
- *blue |= *blue >> bbits;
- bbits <<= 1;
+ *blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits);
+ while (bbits < 16) {
+ *blue |= *blue >> bbits;
+ bbits <<= 1;
+ }
+ } else {
+ *red = 0x0000;
+ *green = 0x0000;
+ *blue = 0x0000;
}
if (abits) {