summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-10-09 11:31:44 +0200
committerMichel Dänzer <michel@daenzer.net>2009-10-10 12:19:57 +0200
commitb6e723eaebe79116dfa15162851b02bbdc29be2a (patch)
treef985b4edef054b251dd3dec9ca5acb65dd91eb82
parent2e37bda8d6b0203973893d8440d9917975f53d97 (diff)
EXA: Fix exaTryDriverSolidFill() for solid source pictures.
Solid pictures have a NULL pFormat field, but their format is always PICT_a8r8g8b8. Signed-off-by: Michel Dänzer <daenzer@vmware.com> Signed-off-by: Keith Packard <keithp@keithp.com> (cherry picked from commit 1088073b11ed488c0df45af3867b900ef93c6fe1)
-rw-r--r--exa/exa_render.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/exa/exa_render.c b/exa/exa_render.c
index 70701a2b3..db355d6c3 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -185,24 +185,33 @@ exaGetRGBAFromPixel(CARD32 pixel,
CARD16 *green,
CARD16 *blue,
CARD16 *alpha,
- PictFormatPtr pFormat)
+ PictFormatPtr pFormat,
+ PictFormatShort format)
{
int rbits, bbits, gbits, abits;
int rshift, bshift, gshift, ashift;
- if (!PICT_FORMAT_COLOR(pFormat->format) &&
- PICT_FORMAT_TYPE(pFormat->format) != PICT_TYPE_A)
+ if (!PICT_FORMAT_COLOR(format) && PICT_FORMAT_TYPE(format) != PICT_TYPE_A)
return FALSE;
- rbits = PICT_FORMAT_R(pFormat->format);
- gbits = PICT_FORMAT_G(pFormat->format);
- bbits = PICT_FORMAT_B(pFormat->format);
- abits = PICT_FORMAT_A(pFormat->format);
-
- rshift = pFormat->direct.red;
- gshift = pFormat->direct.green;
- bshift = pFormat->direct.blue;
- ashift = pFormat->direct.alpha;
+ rbits = PICT_FORMAT_R(format);
+ gbits = PICT_FORMAT_G(format);
+ bbits = PICT_FORMAT_B(format);
+ abits = PICT_FORMAT_A(format);
+
+ if (pFormat) {
+ rshift = pFormat->direct.red;
+ gshift = pFormat->direct.green;
+ bshift = pFormat->direct.blue;
+ ashift = pFormat->direct.alpha;
+ } else if (format == PICT_a8r8g8b8) {
+ rshift = 16;
+ gshift = 8;
+ bshift = 0;
+ ashift = 24;
+ } else
+ FatalError("EXA bug: exaGetRGBAFromPixel() doesn't match "
+ "createSourcePicture()\n");
if (rbits) {
*red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
@@ -293,7 +302,7 @@ exaTryDriverSolidFill(PicturePtr pSrc,
pixel = pSrc->pSourcePict->solidFill.color;
if (!exaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha,
- pSrc->pFormat) ||
+ pSrc->pFormat, pSrc->format) ||
!exaGetPixelFromRGBA(&pixel, red, green, blue, alpha,
pDst->pFormat))
{