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>
This commit is contained in:
Ben Skeggs 2009-10-09 16:08:15 -07:00 committed by Keith Packard
parent b375be9285
commit 55305cf8db

View File

@ -204,6 +204,7 @@ exaGetRGBAFromPixel(CARD32 pixel,
bshift = pFormat->direct.blue;
ashift = pFormat->direct.alpha;
if (rbits) {
*red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
while (rbits < 16) {
*red |= *red >> rbits;
@ -221,6 +222,11 @@ exaGetRGBAFromPixel(CARD32 pixel,
*blue |= *blue >> bbits;
bbits <<= 1;
}
} else {
*red = 0x0000;
*green = 0x0000;
*blue = 0x0000;
}
if (abits) {
*alpha = ((pixel >> ashift ) & ((1 << abits) - 1)) << (16 - abits);