From: Michel Dänzer <[email protected]>

Solid pictures have a NULL pFormat field, but their format is always
PICT_a8r8g8b8.

Signed-off-by: Michel Dänzer <[email protected]>
---
 exa/exa_render.c |   35 ++++++++++++++++++++++-------------
 1 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/exa/exa_render.c b/exa/exa_render.c
index 1c18566..8967d35 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");
 
     *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
     while (rbits < 16) {
@@ -287,7 +296,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))
     {
-- 
1.6.4.3

_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to