[PATCH 1/3] gdi32: Pass a DC pointer to get_mono_dc_colors().

Huw Davies huw at codeweavers.com
Thu Jul 28 04:49:46 CDT 2016


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/gdi32/bitblt.c        | 12 ++++++------
 dlls/gdi32/dib.c           |  2 +-
 dlls/gdi32/dibdrv/bitblt.c |  3 ++-
 dlls/gdi32/gdi_private.h   |  2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index 7e9a096..2506c02 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -222,10 +222,10 @@ static DWORD blend_bits( const BITMAPINFO *src_info, const struct gdi_image_bits
 }
 
 /* helper to retrieve either both colors or only the background color for monochrome blits */
-void get_mono_dc_colors( HDC hdc, BITMAPINFO *info, int count )
+void get_mono_dc_colors( DC *dc, BITMAPINFO *info, int count )
 {
     RGBQUAD *colors = info->bmiColors;
-    COLORREF color = GetBkColor( hdc );
+    COLORREF color = dc->backgroundColor;
 
     colors[count - 1].rgbRed      = GetRValue( color );
     colors[count - 1].rgbGreen    = GetGValue( color );
@@ -234,7 +234,7 @@ void get_mono_dc_colors( HDC hdc, BITMAPINFO *info, int count )
 
     if (count > 1)
     {
-        color = GetTextColor( hdc );
+        color = dc->textColor;
         colors[0].rgbRed      = GetRValue( color );
         colors[0].rgbGreen    = GetGValue( color );
         colors[0].rgbBlue     = GetBValue( color );
@@ -275,7 +275,7 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
 
         /* 1-bpp source without a color table uses the destination DC colors */
         if (src_info->bmiHeader.biBitCount == 1 && !src_info->bmiHeader.biClrUsed)
-            get_mono_dc_colors( dst_dev->hdc, src_info, 2 );
+            get_mono_dc_colors( dc_dst, src_info, 2 );
 
         if (dst_info->bmiHeader.biBitCount == 1 && !dst_colors)
         {
@@ -283,9 +283,9 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
              * that contains only the background color; except with a 1-bpp source,
              * in which case it uses the source colors */
             if (src_info->bmiHeader.biBitCount > 1)
-                get_mono_dc_colors( src_dev->hdc, dst_info, 1 );
+                get_mono_dc_colors( dc_src, dst_info, 1 );
             else
-                get_mono_dc_colors( src_dev->hdc, dst_info, 2 );
+                get_mono_dc_colors( dc_src, dst_info, 2 );
         }
 
         if (!(err = convert_bits( src_info, src, dst_info, &bits )))
diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index 9a1414e..c47729d 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -581,7 +581,7 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
         if (dst_info->bmiHeader.biBitCount == 1 && !dst_colors)
         {
             if (src_info->bmiHeader.biBitCount > 1)
-                get_mono_dc_colors( dev->hdc, dst_info, 1 );
+                get_mono_dc_colors( dc, dst_info, 1 );
             else
             {
                 memcpy( dst_info->bmiColors, src_info->bmiColors, 2 * sizeof(dst_info->bmiColors[0]) );
diff --git a/dlls/gdi32/dibdrv/bitblt.c b/dlls/gdi32/dibdrv/bitblt.c
index 41311fa..d865ffb 100644
--- a/dlls/gdi32/dibdrv/bitblt.c
+++ b/dlls/gdi32/dibdrv/bitblt.c
@@ -985,6 +985,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
                        const struct gdi_image_bits *bits, struct bitblt_coords *src,
                        struct bitblt_coords *dst, DWORD rop )
 {
+    DC *dc = get_physdev_dc( dev );
     struct clipped_rects clipped_rects;
     DWORD ret = ERROR_SUCCESS;
     dib_info src_dib;
@@ -1000,7 +1001,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
 
     /* For mask_rect, 1-bpp source without a color table uses the destination DC colors */
     if (info->bmiHeader.biBitCount == 1 && pdev->dib.bit_count != 1 && !info->bmiHeader.biClrUsed)
-        get_mono_dc_colors( dev->hdc, info, 2 );
+        get_mono_dc_colors( dc, info, 2 );
 
     init_dib_info_from_bitmapinfo( &src_dib, info, bits->ptr );
     src_dib.bits.is_copy = bits->is_copy;
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index a837215..de8db4c 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -199,7 +199,7 @@ extern BOOL intersect_vis_rectangles( struct bitblt_coords *dst, struct bitblt_c
 extern DWORD stretch_bits( const BITMAPINFO *src_info, struct bitblt_coords *src,
                            BITMAPINFO *dst_info, struct bitblt_coords *dst,
                            struct gdi_image_bits *bits, int mode ) DECLSPEC_HIDDEN;
-extern void get_mono_dc_colors( HDC hdc, BITMAPINFO *info, int count ) DECLSPEC_HIDDEN;
+extern void get_mono_dc_colors( DC *dc, BITMAPINFO *info, int count ) DECLSPEC_HIDDEN;
 
 /* brush.c */
 extern BOOL store_brush_pattern( LOGBRUSH *brush, struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
-- 
2.7.4




More information about the wine-patches mailing list