Alexandre Julliard : gdi32: Force colors to black and white for 1-bpp source in AlphaBlend.

Alexandre Julliard julliard at winehq.org
Tue Sep 20 13:08:35 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Sep 20 15:27:36 2011 +0200

gdi32: Force colors to black and white for 1-bpp source in AlphaBlend.

---

 dlls/gdi32/bitblt.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index 98ced52..294901d 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -293,6 +293,20 @@ BOOL nulldrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
     err = dst_dev->funcs->pBlendImage( dst_dev, dst_info, &bits, src, dst, func );
     if (err == ERROR_BAD_FORMAT)
     {
+        /* 1-bpp source without a color table uses black & white */
+        if (src_info->bmiHeader.biBitCount == 1 && !src_info->bmiHeader.biClrUsed)
+        {
+            src_info->bmiColors[0].rgbRed      = 0;
+            src_info->bmiColors[0].rgbGreen    = 0;
+            src_info->bmiColors[0].rgbBlue     = 0;
+            src_info->bmiColors[0].rgbReserved = 0;
+            src_info->bmiColors[1].rgbRed      = 0xff;
+            src_info->bmiColors[1].rgbGreen    = 0xff;
+            src_info->bmiColors[1].rgbBlue     = 0xff;
+            src_info->bmiColors[1].rgbReserved = 0;
+            src_info->bmiHeader.biClrUsed = 2;
+        }
+
         err = convert_bits( src_info, src, dst_info, &bits );
         if (!err) err = dst_dev->funcs->pBlendImage( dst_dev, dst_info, &bits, src, dst, func );
     }




More information about the wine-cvs mailing list