Alexandre Julliard : gdi32: Set the color maps to the destination DC colors for 1-bpp images.
Alexandre Julliard
julliard at winehq.org
Wed Jul 20 12:54:40 CDT 2011
Module: wine
Branch: master
Commit: 414fe85c8a99af38599cc4815fb855b10bfa77a6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=414fe85c8a99af38599cc4815fb855b10bfa77a6
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Jul 19 14:11:04 2011 +0200
gdi32: Set the color maps to the destination DC colors for 1-bpp images.
---
dlls/gdi32/bitblt.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index e87ecfd..0b61729 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -224,6 +224,34 @@ try_get_image:
{
RECT src_rect = src->visrect;
+ /* 1-bpp source without a color table uses the destination DC colors */
+ if (src_info->bmiHeader.biBitCount == 1 && !src_info->bmiHeader.biClrUsed)
+ {
+ COLORREF color = GetTextColor( dst_dev->hdc );
+ src_info->bmiColors[0].rgbRed = GetRValue( color );
+ src_info->bmiColors[0].rgbGreen = GetGValue( color );
+ src_info->bmiColors[0].rgbBlue = GetBValue( color );
+ src_info->bmiColors[0].rgbReserved = 0;
+ color = GetBkColor( dst_dev->hdc );
+ src_info->bmiColors[1].rgbRed = GetRValue( color );
+ src_info->bmiColors[1].rgbGreen = GetGValue( color );
+ src_info->bmiColors[1].rgbBlue = GetBValue( color );
+ src_info->bmiColors[1].rgbReserved = 0;
+ src_info->bmiHeader.biClrUsed = 2;
+ }
+
+ /* 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( src_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;
+ }
+
offset_rect( &src_rect, src_bits.offset - src->visrect.left, -src->visrect.top );
dst_info->bmiHeader.biWidth = src_rect.right - src_rect.left;
dst_bits.ptr = HeapAlloc( GetProcessHeap(), 0, get_dib_image_size( dst_info ));
@@ -233,7 +261,11 @@ try_get_image:
dst_bits.offset = 0;
dst_bits.free = free_heap_bits;
if (!(err = convert_bitmapinfo( src_info, src_bits.ptr, &src_rect, dst_info, dst_bits.ptr )))
+ {
+ /* get rid of the fake 1-bpp table */
+ if (dst_info->bmiHeader.biClrUsed == 1) dst_info->bmiHeader.biClrUsed = 0;
err = dst_dev->funcs->pPutImage( dst_dev, 0, dst_info, &dst_bits, &dst->visrect, rop );
+ }
if (dst_bits.free) dst_bits.free( &dst_bits );
}
else err = ERROR_OUTOFMEMORY;
More information about the wine-cvs
mailing list