From 07528a24b9d93caf7fcac068a97d9971b144a515 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 19 Jul 2011 20:06:32 +0200 Subject: [PATCH] gdi32: Add a special case for converting dibs to 1-bpp using the background color. --- dlls/gdi32/dibdrv/primitives.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/gdi32/dibdrv/primitives.c b/dlls/gdi32/dibdrv/primitives.c index f2908e81346..e1e9acabee7 100644 --- a/dlls/gdi32/dibdrv/primitives.c +++ b/dlls/gdi32/dibdrv/primitives.c @@ -692,6 +692,14 @@ static DWORD colorref_to_pixel_colortable(const dib_info *dib, COLORREF color) rgb.rgbGreen = GetGValue(color); rgb.rgbBlue = GetBValue(color); + /* special case for conversion to 1-bpp without a color table: + * we get a 1-entry table containing the background color + */ + if (dib->bit_count == 1 && dib->color_table_size == 1) + return (rgb.rgbRed == dib->color_table[0].rgbRed && + rgb.rgbGreen == dib->color_table[0].rgbGreen && + rgb.rgbBlue == dib->color_table[0].rgbBlue); + for(i = 0; i < dib->color_table_size; i++) { RGBQUAD *cur = dib->color_table + i;