From d8b7c0ee97ecbc0515e69e0a7a5dd76f4ea8a8d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Mon, 23 Feb 2004 22:44:52 +0000 Subject: [PATCH] Fix mono -> color bitblts svn path=/trunk/; revision=8345 --- reactos/subsys/win32k/objects/bitmaps.c | 28 ++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/reactos/subsys/win32k/objects/bitmaps.c b/reactos/subsys/win32k/objects/bitmaps.c index e8bff7e148b..916f5932373 100644 --- a/reactos/subsys/win32k/objects/bitmaps.c +++ b/reactos/subsys/win32k/objects/bitmaps.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: bitmaps.c,v 1.56 2004/02/20 07:45:58 royce Exp $ */ +/* $Id: bitmaps.c,v 1.57 2004/02/23 22:44:52 gvg Exp $ */ #undef WIN32_LEAN_AND_MEAN #include #include @@ -61,6 +61,7 @@ BOOL STDCALL NtGdiBitBlt(HDC hDCDest, PBRUSHOBJ BrushObj; BOOL UsesSource = ((ROP & 0xCC0000) >> 2) != (ROP & 0x330000); BOOL UsesPattern = TRUE;//((ROP & 0xF00000) >> 4) != (ROP & 0x0F0000); + HPALETTE Mono = NULL; DCDest = DC_LockDc(hDCDest); if (NULL == DCDest) @@ -196,17 +197,38 @@ BOOL STDCALL NtGdiBitBlt(HDC hDCDest, PALETTE_UnlockPalette(DestPalette); } + /* KB41464 details how to convert between mono and color */ if (DCDest->w.bitsPerPixel == 1) { XlateObj = (PXLATEOBJ)IntEngCreateMonoXlate(SourceMode, DestPalette, SourcePalette, DCSrc->w.backgroundColor); } + else if (UsesSource && 1 == DCSrc->w.bitsPerPixel) + { + ULONG Colors[2]; + + Colors[0] = DCSrc->w.textColor; + Colors[1] = DCSrc->w.backgroundColor; + Mono = EngCreatePalette(PAL_INDEXED, 2, Colors, 0, 0, 0); + if (NULL != Mono) + { + XlateObj = (PXLATEOBJ)IntEngCreateXlate(DestMode, PAL_INDEXED, DestPalette, Mono); + } + else + { + XlateObj = NULL; + } + } else { XlateObj = (PXLATEOBJ)IntEngCreateXlate(DestMode, SourceMode, DestPalette, SourcePalette); } if (NULL == XlateObj) { + if (NULL != Mono) + { + EngDeletePalette(Mono); + } if (UsesSource && hDCSrc != hDCDest) { DC_UnlockDc(hDCSrc); @@ -221,6 +243,10 @@ BOOL STDCALL NtGdiBitBlt(HDC hDCDest, &DestRect, &SourcePoint, NULL, BrushObj, NULL, ROP); EngDeleteXlate(XlateObj); + if (NULL != Mono) + { + EngDeletePalette(Mono); + } if (UsesPattern) { BRUSHOBJ_UnlockBrush(DCDest->w.hBrush);