Huw Davies : gdi32: Add a fake 1-entry color table for 1-bpp ddbs.
Alexandre Julliard
julliard at winehq.org
Fri Oct 21 11:02:01 CDT 2011
Module: wine
Branch: master
Commit: f53d73a017a4ca5682f6ae6d216d71828488eb21
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f53d73a017a4ca5682f6ae6d216d71828488eb21
Author: Huw Davies <huw at codeweavers.com>
Date: Fri Oct 21 14:52:34 2011 +0100
gdi32: Add a fake 1-entry color table for 1-bpp ddbs.
---
dlls/gdi32/dib.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index 550f099..8eba236 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -501,8 +501,24 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
err = dev->funcs->pPutImage( dev, 0, clip, dst_info, &src_bits, &src, &dst, rop );
if (err == ERROR_BAD_FORMAT)
{
- err = convert_bits( src_info, &src, dst_info, &src_bits, FALSE );
- if (!err) err = dev->funcs->pPutImage( dev, 0, clip, dst_info, &src_bits, &src, &dst, rop );
+ /* 1-bpp destination without a color table requires a fake 1-entry table
+ * that contains only the background color */
+ if (dst_info->bmiHeader.biBitCount == 1 && !dst_info->bmiHeader.biClrUsed)
+ {
+ COLORREF color = GetBkColor( dev->hdc );
+ dst_info->bmiColors[0].rgbRed = GetRValue( color );
+ dst_info->bmiColors[0].rgbGreen = GetGValue( color );
+ dst_info->bmiColors[0].rgbBlue = GetBValue( color );
+ dst_info->bmiColors[0].rgbReserved = 0;
+ dst_info->bmiHeader.biClrUsed = 1;
+ }
+
+ if (!(err = convert_bits( src_info, &src, dst_info, &src_bits, FALSE )))
+ {
+ /* get rid of the fake 1-bpp table */
+ if (dst_info->bmiHeader.biClrUsed == 1) dst_info->bmiHeader.biClrUsed = 0;
+ err = dev->funcs->pPutImage( dev, 0, clip, dst_info, &src_bits, &src, &dst, rop );
+ }
}
if (err == ERROR_TRANSFORM_NOT_SUPPORTED)
More information about the wine-cvs
mailing list