Jacek Caban : gdi32: Move ROP mode to DC_ATTR.

Alexandre Julliard julliard at winehq.org
Wed Jul 28 15:37:41 CDT 2021


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Jul 28 11:39:05 2021 +0200

gdi32: Move ROP mode to 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              | 25 ++++---------------------
 dlls/gdi32/dibdrv/graphics.c |  4 ++--
 dlls/gdi32/dibdrv/objects.c  |  4 ++--
 dlls/gdi32/gdidc.c           |  9 +++++++++
 dlls/gdi32/ntgdi_private.h   |  1 -
 include/ntgdi.h              |  1 +
 6 files changed, 18 insertions(+), 26 deletions(-)

diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 5f86bb524ba..0f793dd76cc 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -82,7 +82,7 @@ static void set_initial_dc_state( DC *dc )
     dc->miterLimit          = 10.0f; /* 10.0 is the default, from MSDN */
     dc->layout              = 0;
     dc->font_code_page      = CP_ACP;
-    dc->ROPmode             = R2_COPYPEN;
+    dc->attr->rop_mode      = R2_COPYPEN;
     dc->polyFillMode        = ALTERNATE;
     dc->stretchBltMode      = BLACKONWHITE;
     dc->relAbsMode          = ABSOLUTE;
@@ -399,7 +399,6 @@ INT CDECL nulldrv_SaveDC( PHYSDEV dev )
     newdc->hFont            = dc->hFont;
     newdc->hBitmap          = dc->hBitmap;
     newdc->hPalette         = dc->hPalette;
-    newdc->ROPmode          = dc->ROPmode;
     newdc->polyFillMode     = dc->polyFillMode;
     newdc->stretchBltMode   = dc->stretchBltMode;
     newdc->relAbsMode       = dc->relAbsMode;
@@ -472,7 +471,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
     if (!PATH_RestorePath( dc, dcs )) return FALSE;
 
     dc->layout           = dcs->layout;
-    dc->ROPmode          = dcs->ROPmode;
+    dc->attr->rop_mode   = dcs->attr->rop_mode;
     dc->polyFillMode     = dcs->polyFillMode;
     dc->stretchBltMode   = dcs->stretchBltMode;
     dc->relAbsMode       = dcs->relAbsMode;
@@ -1555,22 +1554,6 @@ INT WINAPI GetRelAbs( HDC hdc, DWORD dwIgnore )
 }
 
 
-/***********************************************************************
- *		GetROP2 (GDI32.@)
- */
-INT WINAPI GetROP2( HDC hdc )
-{
-    INT ret = 0;
-    DC * dc = get_dc_ptr( hdc );
-    if (dc)
-    {
-        ret = dc->ROPmode;
-        release_dc_ptr( dc );
-    }
-    return ret;
-}
-
-
 /***********************************************************************
  *		SetROP2 (GDI32.@)
  */
@@ -1590,8 +1573,8 @@ INT WINAPI SetROP2( HDC hdc, INT mode )
         mode = physdev->funcs->pSetROP2( physdev, mode );
         if (mode)
         {
-            ret = dc->ROPmode;
-            dc->ROPmode = mode;
+            ret = dc->attr->rop_mode;
+            dc->attr->rop_mode = mode;
         }
         release_dc_ptr( dc );
     }
diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
index 62384601c5a..6dc79e53b36 100644
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -73,7 +73,7 @@ static BOOL brush_rect( dibdrv_physdev *pdev, dib_brush *brush, const RECT *rect
 
     if (!get_clipped_rects( &pdev->dib, rect, clip, &clipped_rects )) return TRUE;
     ret = brush->rects( pdev, brush, &pdev->dib, clipped_rects.count, clipped_rects.rects,
-                        &dc->brush_org, dc->ROPmode );
+                        &dc->brush_org, dc->attr->rop_mode );
     free_clipped_rects( &clipped_rects );
     return ret;
 }
@@ -1590,7 +1590,7 @@ COLORREF CDECL dibdrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
     color = pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel );
 
     if (!get_clipped_rects( &pdev->dib, &rect, pdev->clip, &clipped_rects )) return color;
-    fill_with_pixel( dc, &pdev->dib, pixel, clipped_rects.count, clipped_rects.rects, dc->ROPmode );
+    fill_with_pixel( dc, &pdev->dib, pixel, clipped_rects.count, clipped_rects.rects, dc->attr->rop_mode );
     free_clipped_rects( &clipped_rects );
     return color;
 }
diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c
index 504e3bc2438..489b2497ff2 100644
--- a/dlls/gdi32/dibdrv/objects.c
+++ b/dlls/gdi32/dibdrv/objects.c
@@ -819,7 +819,7 @@ static BOOL solid_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL clos
         DWORD color, and, xor;
 
         color = get_pixel_color( dc, &pdev->dib, pdev->pen_brush.colorref, TRUE );
-        calc_and_xor_masks( dc->ROPmode, color, &and, &xor );
+        calc_and_xor_masks( dc->attr->rop_mode, color, &and, &xor );
 
         for (i = 0; i < num - 1; i++)
             if (!solid_pen_line( pdev, pts + i, pts + i + 1, and, xor ))
@@ -1229,7 +1229,7 @@ static BOOL dashed_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL clo
     }
     else
     {
-        get_color_masks( dc, &pdev->dib, dc->ROPmode, pdev->pen_brush.colorref,
+        get_color_masks( dc, &pdev->dib, dc->attr->rop_mode, pdev->pen_brush.colorref,
                          pdev->pen_is_ext ? TRANSPARENT : dc->attr->background_mode,
                          &pdev->dash_masks[1], &pdev->dash_masks[0] );
 
diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index 1318533d100..df6bc75c32d 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -108,6 +108,15 @@ BOOL WINAPI GetCurrentPositionEx( HDC hdc, POINT *point )
     return TRUE;
 }
 
+/***********************************************************************
+ *		GetROP2 (GDI32.@)
+ */
+INT WINAPI GetROP2( HDC hdc )
+{
+    DC_ATTR *dc_attr = get_dc_attr( hdc );
+    return dc_attr ? dc_attr->rop_mode : 0;
+}
+
 /***********************************************************************
  *           SetPixel    (GDI32.@)
  */
diff --git a/dlls/gdi32/ntgdi_private.h b/dlls/gdi32/ntgdi_private.h
index 6efc3f2e7d1..812e435d664 100644
--- a/dlls/gdi32/ntgdi_private.h
+++ b/dlls/gdi32/ntgdi_private.h
@@ -117,7 +117,6 @@ typedef struct tagDC
     const struct font_gamma_ramp *font_gamma_ramp;
 
     UINT          font_code_page;
-    WORD          ROPmode;
     WORD          polyFillMode;
     WORD          stretchBltMode;
     WORD          relAbsMode;
diff --git a/include/ntgdi.h b/include/ntgdi.h
index f1a3436437f..ec7e650d1b4 100644
--- a/include/ntgdi.h
+++ b/include/ntgdi.h
@@ -103,6 +103,7 @@ typedef struct DC_ATTR
     INT       graphics_mode;
     WORD      text_align;
     WORD      background_mode;
+    WORD      rop_mode;
     void     *emf;
 } DC_ATTR;
 




More information about the wine-cvs mailing list