# HG changeset patch
# User Tim Worthington
# Date 1500821635 -36000
#      Mon Jul 24 00:53:55 2017 +1000
# Node ID abeabc82463029a32118ee1a4ba4963782aa1326
# Parent  d6ff24b5f01c0599b288d4587c5d963c3305649e
[2/2] gdi32: Set mix mode for SetPixel in DIB driver

Fixes https://bugs.winehq.org/show_bug.cgi?id=41422

Signed-off-by: Tim Worthington <tim@pcbelegance.org>

diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h
--- a/dlls/gdi32/dibdrv/dibdrv.h
+++ b/dlls/gdi32/dibdrv/dibdrv.h
@@ -282,3 +282,5 @@
 {
     return dib->color_table ? dib->color_table : get_default_color_table( dib->bit_count );
 }
+
+extern void calc_and_xor_masks(INT rop, DWORD color, DWORD *and, DWORD *xor);
diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -1583,7 +1583,7 @@
     struct clipped_rects clipped_rects;
     RECT rect;
     POINT pt;
-    DWORD pixel;
+    DWORD pixel, and, xor;
 
     TRACE( "(%p, %d, %d, %08x)\n", dev, x, y, color );
 
@@ -1599,9 +1599,10 @@
     /* SetPixel doesn't do the 1bpp massaging like other fg colors */
     pixel = get_pixel_color( dc, &pdev->dib, color, FALSE );
     color = pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel );
+    calc_and_xor_masks( dc->ROPmode, pixel, &and, &xor );
 
     if (!get_clipped_rects( &pdev->dib, &rect, pdev->clip, &clipped_rects )) return color;
-    pdev->dib.funcs->solid_rects( &pdev->dib, clipped_rects.count, clipped_rects.rects, 0, pixel );
+    pdev->dib.funcs->solid_rects( &pdev->dib, clipped_rects.count, clipped_rects.rects, and, xor );
     free_clipped_rects( &clipped_rects );
     return color;
 }
diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c
--- a/dlls/gdi32/dibdrv/objects.c
+++ b/dlls/gdi32/dibdrv/objects.c
@@ -94,7 +94,7 @@
     codes->x2 = rop2_xor_array[rop-1][1];
 }
 
-static inline void calc_and_xor_masks(INT rop, DWORD color, DWORD *and, DWORD *xor)
+void calc_and_xor_masks(INT rop, DWORD color, DWORD *and, DWORD *xor)
 {
     struct rop_codes codes;
     get_rop_codes( rop, &codes );
