Jacek Caban : gdi32: Store poly fill mode in DC_ATTR.

Alexandre Julliard julliard at winehq.org
Thu Jul 29 16:37:52 CDT 2021


Module: wine
Branch: master
Commit: 22f7e39fb773dc3e8801432acbf96fca3b86cb88
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=22f7e39fb773dc3e8801432acbf96fca3b86cb88

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Jul 29 13:22:00 2021 +0100

gdi32: Store poly fill mode in DC_ATTR.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/dc.c              | 28 +++++-----------------------
 dlls/gdi32/dibdrv/graphics.c |  3 ++-
 dlls/gdi32/gdidc.c           |  9 +++++++++
 dlls/gdi32/ntgdi_private.h   |  1 -
 dlls/gdi32/path.c            |  4 ++--
 dlls/gdi32/tests/metafile.c  |  2 +-
 include/ntgdi.h              |  1 +
 7 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index c8124b25960..7af91e3bcdb 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -83,8 +83,8 @@ static void set_initial_dc_state( DC *dc )
     dc->attr->layout        = 0;
     dc->font_code_page      = CP_ACP;
     dc->attr->rop_mode      = R2_COPYPEN;
-    dc->polyFillMode        = ALTERNATE;
-    dc->stretchBltMode      = BLACKONWHITE;
+    dc->attr->poly_fill_mode   = ALTERNATE;
+    dc->stretchBltMode         = BLACKONWHITE;
     dc->attr->rel_abs_mode     = ABSOLUTE;
     dc->attr->background_mode  = OPAQUE;
     dc->attr->background_color = RGB( 255, 255, 255 );
@@ -398,8 +398,6 @@ INT CDECL nulldrv_SaveDC( PHYSDEV dev )
     newdc->hFont            = dc->hFont;
     newdc->hBitmap          = dc->hBitmap;
     newdc->hPalette         = dc->hPalette;
-    newdc->polyFillMode     = dc->polyFillMode;
-    newdc->stretchBltMode   = dc->stretchBltMode;
     newdc->dcBrushColor     = dc->dcBrushColor;
     newdc->dcPenColor       = dc->dcPenColor;
     newdc->brush_org        = dc->brush_org;
@@ -467,7 +465,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
 
     dc->attr->layout     = dcs->attr->layout;
     dc->attr->rop_mode   = dcs->attr->rop_mode;
-    dc->polyFillMode     = dcs->polyFillMode;
+    dc->attr->poly_fill_mode   = dcs->attr->poly_fill_mode;
     dc->stretchBltMode   = dcs->stretchBltMode;
     dc->attr->rel_abs_mode     = dcs->attr->rel_abs_mode;
     dc->attr->background_mode  = dcs->attr->background_mode;
@@ -1394,22 +1392,6 @@ UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
 }
 
 
-/***********************************************************************
- *		GetPolyFillMode (GDI32.@)
- */
-INT WINAPI GetPolyFillMode( HDC hdc )
-{
-    INT ret = 0;
-    DC * dc = get_dc_ptr( hdc );
-    if (dc)
-    {
-        ret = dc->polyFillMode;
-        release_dc_ptr( dc );
-    }
-    return ret;
-}
-
-
 /***********************************************************************
  *		SetPolyFillMode (GDI32.@)
  */
@@ -1429,8 +1411,8 @@ INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
         mode = physdev->funcs->pSetPolyFillMode( physdev, mode );
         if (mode)
         {
-            ret = dc->polyFillMode;
-            dc->polyFillMode = mode;
+            ret = dc->attr->poly_fill_mode;
+            dc->attr->poly_fill_mode = mode;
         }
         release_dc_ptr( dc );
     }
diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
index 30ffad70b02..e4e2de8f99f 100644
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -1271,7 +1271,8 @@ BOOL CDECL dibdrv_PolyPolygon( PHYSDEV dev, const POINT *pt, const INT *counts,
 
     if (pdev->brush.style != BS_NULL &&
         get_dib_rect( &pdev->dib, &rc ) &&
-        !(interior = create_polypolygon_region( points, counts, polygons, dc->polyFillMode, &rc )))
+        !(interior = create_polypolygon_region( points, counts, polygons,
+                                                dc->attr->poly_fill_mode, &rc )))
     {
         ret = FALSE;
         goto done;
diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index 7aaa7a24b9f..b3ec0cf5587 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -164,6 +164,15 @@ DWORD WINAPI GetLayout( HDC hdc )
     return dc_attr ? dc_attr->layout : GDI_ERROR;
 }
 
+/***********************************************************************
+ *		GetPolyFillMode  (GDI32.@)
+ */
+INT WINAPI GetPolyFillMode( HDC hdc )
+{
+    DC_ATTR *dc_attr = get_dc_attr( hdc );
+    return dc_attr ? dc_attr->poly_fill_mode : 0;
+}
+
 /***********************************************************************
  *		GetCurrentPositionEx (GDI32.@)
  */
diff --git a/dlls/gdi32/ntgdi_private.h b/dlls/gdi32/ntgdi_private.h
index 21a6f6bbc01..262971f2a8a 100644
--- a/dlls/gdi32/ntgdi_private.h
+++ b/dlls/gdi32/ntgdi_private.h
@@ -116,7 +116,6 @@ typedef struct tagDC
     const struct font_gamma_ramp *font_gamma_ramp;
 
     UINT          font_code_page;
-    WORD          polyFillMode;
     WORD          stretchBltMode;
     COLORREF      dcBrushColor;
     COLORREF      dcPenColor;
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index 8761723f62e..b9414967982 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -537,7 +537,7 @@ struct gdi_path *get_gdi_flat_path( DC *dc, HRGN *rgn )
 
         free_gdi_path( dc->path );
         dc->path = NULL;
-        if (ret && rgn) *rgn = path_to_region( ret, dc->polyFillMode );
+        if (ret && rgn) *rgn = path_to_region( ret, dc->attr->poly_fill_mode );
     }
     else SetLastError( ERROR_CAN_NOT_COMPLETE );
 
@@ -684,7 +684,7 @@ HRGN WINAPI PathToRegion(HDC hdc)
         dc->path = NULL;
         if (path)
         {
-            ret = path_to_region( path, dc->polyFillMode );
+            ret = path_to_region( path, dc->attr->poly_fill_mode );
             free_gdi_path( path );
         }
     }
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index 1a38735f044..35a3d2ab82b 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -900,7 +900,7 @@ static void test_mf_SaveDC(void)
 
     SetPolyFillMode( hdcMetafile, WINDING );
     SetBkColor( hdcMetafile, 0x123456 );
-    todo_wine ok( !GetPolyFillMode( hdcMetafile ), "GetPolyFillMode succeeded\n" );
+    ok( !GetPolyFillMode( hdcMetafile ), "GetPolyFillMode succeeded\n" );
     ok( GetBkColor( hdcMetafile ) == CLR_INVALID, "GetBkColor succeeded\n" );
 
     /* Force Win9x to update DC state */
diff --git a/include/ntgdi.h b/include/ntgdi.h
index 19c31cd3190..38798213f88 100644
--- a/include/ntgdi.h
+++ b/include/ntgdi.h
@@ -107,6 +107,7 @@ typedef struct DC_ATTR
     DWORD     layout;
     WORD      text_align;
     WORD      background_mode;
+    WORD      poly_fill_mode;
     WORD      rop_mode;
     WORD      rel_abs_mode;
     void     *emf;




More information about the wine-cvs mailing list