Alexandre Julliard : gdi32: Add a special case for converting dibs to 1-bpp using the background color .

Alexandre Julliard julliard at winehq.org
Wed Jul 20 12:54:40 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jul 19 20:06:32 2011 +0200

gdi32: Add a special case for converting dibs to 1-bpp using the background color.

---

 dlls/gdi32/dibdrv/primitives.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/dibdrv/primitives.c b/dlls/gdi32/dibdrv/primitives.c
index f2908e8..e1e9aca 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;




More information about the wine-cvs mailing list