Alexandre Julliard : winex11: Require an A8R8G8B8 format for blending with a source alpha.

Alexandre Julliard julliard at winehq.org
Tue Oct 11 14:03:37 CDT 2011


Module: wine
Branch: master
Commit: d36b7a7f245e8bbc390605a3a0364ca7f04e6027
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d36b7a7f245e8bbc390605a3a0364ca7f04e6027

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Oct 11 11:53:02 2011 +0200

winex11: Require an A8R8G8B8 format for blending with a source alpha.

---

 dlls/winex11.drv/xrender.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index 33ad4bd..cb0ec9b 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -507,7 +507,7 @@ static enum wxr_format get_xrender_format_from_color_shifts(int depth, ColorShif
     return WXR_INVALID_FORMAT;
 }
 
-static enum wxr_format get_xrender_format_from_bitmapinfo( const BITMAPINFO *info, BOOL use_alpha )
+static enum wxr_format get_xrender_format_from_bitmapinfo( const BITMAPINFO *info )
 {
     if (info->bmiHeader.biPlanes != 1) return WXR_INVALID_FORMAT;
 
@@ -539,8 +539,7 @@ static enum wxr_format get_xrender_format_from_bitmapinfo( const BITMAPINFO *inf
             break;
         }
         if (info->bmiHeader.biCompression != BI_RGB) break;
-        if (info->bmiHeader.biBitCount == 16) return WXR_FORMAT_X1R5G5B5;
-        return use_alpha ? WXR_FORMAT_A8R8G8B8 : WXR_FORMAT_X8R8G8B8;
+        return (info->bmiHeader.biBitCount == 16) ? WXR_FORMAT_X1R5G5B5 : WXR_FORMAT_A8R8G8B8;
     }
     return WXR_INVALID_FORMAT;
 }
@@ -2678,7 +2677,7 @@ static DWORD xrenderdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMA
         dst_format = physdev->format;
     }
 
-    src_format = get_xrender_format_from_bitmapinfo( info, TRUE );
+    src_format = get_xrender_format_from_bitmapinfo( info );
     if (!(pict_format = pict_formats[src_format])) goto update_format;
 
     /* make sure we can create an image with the same bpp */
@@ -2792,7 +2791,12 @@ static DWORD xrenderdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct
         return dev->funcs->pBlendImage( dev, info, bits, src, dst, func );
     }
 
-    format = get_xrender_format_from_bitmapinfo( info, func.AlphaFormat & AC_SRC_ALPHA );
+    format = get_xrender_format_from_bitmapinfo( info );
+    if (!(func.AlphaFormat & AC_SRC_ALPHA))
+        format = get_format_without_alpha( format );
+    else if (format != WXR_FORMAT_A8R8G8B8)
+        return ERROR_INVALID_PARAMETER;
+
     if (!(pict_format = pict_formats[format])) goto update_format;
 
     /* make sure we can create an image with the same bpp */
@@ -2866,6 +2870,12 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
         return dst_dev->funcs->pAlphaBlend( dst_dev, dst, src_dev, src, blendfn );
     }
 
+    if ((blendfn.AlphaFormat & AC_SRC_ALPHA) && physdev_src->format != WXR_FORMAT_A8R8G8B8)
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return FALSE;
+    }
+
     if (physdev_dst != physdev_src)
     {
         int status = X11DRV_LockDIBSection( physdev_src->x11dev, DIB_Status_None );




More information about the wine-cvs mailing list