Jacek Caban : gdi32: Store window origin in DC_ATTR.

Alexandre Julliard julliard at winehq.org
Tue Aug 3 16:52:23 CDT 2021


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Aug  3 12:56:01 2021 +0200

gdi32: Store window origin 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            | 24 +++++-------------------
 dlls/gdi32/gdidc.c         | 11 +++++++++++
 dlls/gdi32/mapping.c       | 12 ++++++------
 dlls/gdi32/ntgdi_private.h |  1 -
 include/ntgdi.h            |  1 +
 5 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index cf060f8da3b..4d80ffdc449 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -71,8 +71,8 @@ static inline DC *get_dc_obj( HDC hdc )
  */
 static void set_initial_dc_state( DC *dc )
 {
-    dc->wnd_org.x           = 0;
-    dc->wnd_org.y           = 0;
+    dc->attr->wnd_org.x     = 0;
+    dc->attr->wnd_org.y     = 0;
     dc->wnd_ext.cx          = 1;
     dc->wnd_ext.cy          = 1;
     dc->attr->vport_org.x   = 0;
@@ -327,8 +327,8 @@ static void construct_window_to_viewport(DC *dc, XFORM *xform)
     xform->eM12 = 0.0;
     xform->eM21 = 0.0;
     xform->eM22 = scaleY;
-    xform->eDx  = (double)dc->attr->vport_org.x - scaleX * (double)dc->wnd_org.x;
-    xform->eDy  = (double)dc->attr->vport_org.y - scaleY * (double)dc->wnd_org.y;
+    xform->eDx  = (double)dc->attr->vport_org.x - scaleX * (double)dc->attr->wnd_org.x;
+    xform->eDy  = (double)dc->attr->vport_org.y - scaleY * (double)dc->attr->wnd_org.y;
     if (dc->attr->layout & LAYOUT_RTL)
         xform->eDx = dc->attr->vis_rect.right - dc->attr->vis_rect.left - 1 - xform->eDx;
 }
@@ -424,7 +424,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
     dc->xformWorld2Vport = dcs->xformWorld2Vport;
     dc->xformVport2World = dcs->xformVport2World;
     dc->vport2WorldValid = dcs->vport2WorldValid;
-    dc->wnd_org          = dcs->wnd_org;
+    dc->attr->wnd_org          = dcs->attr->wnd_org;
     dc->wnd_ext          = dcs->wnd_ext;
     dc->attr->vport_org        = dcs->attr->vport_org;
     dc->attr->vport_ext  = dcs->attr->vport_ext;
@@ -553,7 +553,6 @@ INT WINAPI NtGdiSaveDC( HDC hdc )
     newdc->xformWorld2Vport = dc->xformWorld2Vport;
     newdc->xformVport2World = dc->xformVport2World;
     newdc->vport2WorldValid = dc->vport2WorldValid;
-    newdc->wnd_org          = dc->wnd_org;
     newdc->wnd_ext          = dc->wnd_ext;
     newdc->virtual_res      = dc->virtual_res;
     newdc->virtual_size     = dc->virtual_size;
@@ -1302,19 +1301,6 @@ BOOL WINAPI GetWindowExtEx( HDC hdc, LPSIZE size )
 }
 
 
-/***********************************************************************
- *		GetWindowOrgEx (GDI32.@)
- */
-BOOL WINAPI GetWindowOrgEx( HDC hdc, LPPOINT pt )
-{
-    DC * dc = get_dc_ptr( hdc );
-    if (!dc) return FALSE;
-    *pt = dc->wnd_org;
-    release_dc_ptr( dc );
-    return TRUE;
-}
-
-
 /***********************************************************************
  *           SetLayout    (GDI32.@)
  *
diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index 0b8586e8463..06d8e3f807f 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -342,6 +342,17 @@ BOOL WINAPI GetDCOrgEx( HDC hdc, POINT *point )
     return TRUE;
 }
 
+/***********************************************************************
+ *		GetWindowOrgEx (GDI32.@)
+ */
+BOOL WINAPI GetWindowOrgEx( HDC hdc, POINT *point )
+{
+    DC_ATTR *dc_attr;
+    if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
+    *point = dc_attr->wnd_org;
+    return TRUE;
+}
+
 /***********************************************************************
  *		GetViewportExtEx (GDI32.@)
  */
diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c
index d3d7ee60255..a385bf7eac5 100644
--- a/dlls/gdi32/mapping.c
+++ b/dlls/gdi32/mapping.c
@@ -103,10 +103,10 @@ BOOL CDECL nulldrv_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
     DC *dc = get_nulldrv_dc( dev );
 
     if (pt)
-        *pt = dc->wnd_org;
+        *pt = dc->attr->wnd_org;
 
-    dc->wnd_org.x += x;
-    dc->wnd_org.y += y;
+    dc->attr->wnd_org.x += x;
+    dc->attr->wnd_org.y += y;
     DC_UpdateXforms( dc );
     return TRUE;
 }
@@ -262,10 +262,10 @@ BOOL CDECL nulldrv_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
     DC *dc = get_nulldrv_dc( dev );
 
     if (pt)
-        *pt = dc->wnd_org;
+        *pt = dc->attr->wnd_org;
 
-    dc->wnd_org.x = x;
-    dc->wnd_org.y = y;
+    dc->attr->wnd_org.x = x;
+    dc->attr->wnd_org.y = y;
     DC_UpdateXforms( dc );
     return TRUE;
 }
diff --git a/dlls/gdi32/ntgdi_private.h b/dlls/gdi32/ntgdi_private.h
index a966aaeb637..6cd18b20b0b 100644
--- a/dlls/gdi32/ntgdi_private.h
+++ b/dlls/gdi32/ntgdi_private.h
@@ -87,7 +87,6 @@ typedef struct tagDC
     BOOL         bounds_enabled:1; /* bounds tracking is enabled */
     BOOL         path_open:1;      /* path is currently open (only for saved DCs) */
 
-    POINT        wnd_org;          /* Window origin */
     SIZE         wnd_ext;          /* Window extent */
     SIZE         virtual_res;      /* Initially HORZRES,VERTRES. Changed by SetVirtualResolution */
     SIZE         virtual_size;     /* Initially HORZSIZE,VERTSIZE. Changed by SetVirtualResolution */
diff --git a/include/ntgdi.h b/include/ntgdi.h
index e2500d924a3..1bef584a719 100644
--- a/include/ntgdi.h
+++ b/include/ntgdi.h
@@ -116,6 +116,7 @@ typedef struct DC_ATTR
     INT       map_mode;
     RECT      vis_rect;            /* visible rectangle in screen coords */
     FLOAT     miter_limit;
+    POINT     wnd_org;             /* window origin */
     POINT     vport_org;           /* viewport origin */
     SIZE      vport_ext;           /* viewport extent */
     void     *emf;




More information about the wine-cvs mailing list