winex11.drv[2/2]: Support GdiAlphaBlend with blendfn.AlphaFormat == 0 (fixes bug #9262)

Mikolaj Zalewski mikolajz at google.com
Tue Aug 28 13:20:16 CDT 2007


It's quite unclear on MSDN but it's mentioned that AC_SRC_ALPHA is a
flag. If it is not present the alpha channel data of the bitmap is
ignored.
-------------- next part --------------
From 3d8050dff5e5e2875a5cb53f193621b08055ff62 Mon Sep 17 00:00:00 2001
From: Mikolaj Zalewski <mikolaj at zalewski.pl>
Date: Tue, 28 Aug 2007 10:55:31 -0700
Subject: [PATCH] winex11.drv: Support GdiAlphaBlend with blendfn.AlphaFormat == 0 (fixes bug #9262)
---
 dlls/winex11.drv/xrender.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index f01ed7b..c0695c2 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -1579,7 +1579,10 @@ #endif
         SetLastError(ERROR_INVALID_PARAMETER);
         return FALSE;
     }
-    
+
+    if ((blendfn.AlphaFormat & AC_SRC_ALPHA) && blendfn.SourceConstantAlpha != 0xff)
+        FIXME("Ignoring SourceConstantAlpha %d for AC_SRC_ALPHA\n", blendfn.SourceConstantAlpha);
+
     if(dib.dsBm.bmBitsPixel != 32) {
         FIXME("not a 32 bpp dibsection\n");
         return FALSE;
@@ -1600,6 +1603,16 @@ #endif
     for(; y >= y2; y--) {
         memcpy(dstbits, (char *)dib.dsBm.bmBits + y * dib.dsBm.bmWidthBytes + xSrc * 4,
                widthSrc * 4);
+        if (!(blendfn.AlphaFormat & AC_SRC_ALPHA))
+        {
+            int i;
+            RGBQUAD *quad = (RGBQUAD *)dstbits;
+            for (i = 0; i < widthSrc; i++)
+            {
+                quad->rgbReserved = blendfn.SourceConstantAlpha;
+                quad++;
+            }
+        }
         dstbits += (top_down ? -1 : 1) * widthSrc * 4;
     }
 
-- 
1.4.1


More information about the wine-patches mailing list