diff mbox

i915 forces the RGB source alpha to 1...

Message ID 1257868341-29737-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State Rejected
Headers show

Commit Message

Chris Wilson Nov. 10, 2009, 3:52 p.m. UTC
None
diff mbox

Patch

diff --git a/Xext/shm.c b/Xext/shm.c
index 8106c40..74a7265 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -539,6 +539,30 @@  doShmPutImage(DrawablePtr dst, GCPtr pGC,
     PixmapPtr pPixmap;
 
     if (format == ZPixmap || depth == 1) {
+	if (depth == 24) { /* force the xRGB alpha channel to a sane value */
+	    pixman_image_t *src, *dst;
+
+	    src = pixman_image_create_bits (PIXMAN_x8r8g8b8,
+					    w, h,
+					    data,
+					    PixmapBytePad(w, depth));
+	    dst = pixman_image_create_bits (PIXMAN_a8r8g8b8,
+					    w, h,
+					    data,
+					    PixmapBytePad(w, depth));
+	    if (src != NULL && dst != NULL) {
+		    pixman_image_composite (PIXMAN_OP_SRC,
+					    src, NULL, dst,
+					    0, 0, 0, 0, 0, 0,
+					    w, h);
+	    }
+
+	    if (src != NULL)
+		    pixman_image_unref (src);
+	    if (dst != NULL)
+		    pixman_image_unref (dst);
+	}
+
 	pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
 					 BitsPerPixel(depth),
 					 PixmapBytePad(w, depth),