Jacek Caban : gdi32: Store viewport origin in DC_ATTR.
Alexandre Julliard
julliard at winehq.org
Tue Aug 3 16:52:23 CDT 2021
Module: wine
Branch: master
Commit: e349a4a13132c201ecff9757f20d74966deb14f3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e349a4a13132c201ecff9757f20d74966deb14f3
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Aug 3 12:55:55 2021 +0200
gdi32: Store viewport 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 | 13 ++++++-------
dlls/gdi32/ntgdi_private.h | 1 -
dlls/gdi32/tests/metafile.c | 2 +-
include/ntgdi.h | 1 +
6 files changed, 24 insertions(+), 28 deletions(-)
diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index eb48415ace5..cf060f8da3b 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -75,8 +75,8 @@ static void set_initial_dc_state( DC *dc )
dc->wnd_org.y = 0;
dc->wnd_ext.cx = 1;
dc->wnd_ext.cy = 1;
- dc->vport_org.x = 0;
- dc->vport_org.y = 0;
+ dc->attr->vport_org.x = 0;
+ dc->attr->vport_org.y = 0;
dc->attr->vport_ext.cx = 1;
dc->attr->vport_ext.cy = 1;
dc->attr->miter_limit = 10.0f; /* 10.0 is the default, from MSDN */
@@ -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->vport_org.x - scaleX * (double)dc->wnd_org.x;
- xform->eDy = (double)dc->vport_org.y - scaleY * (double)dc->wnd_org.y;
+ 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;
if (dc->attr->layout & LAYOUT_RTL)
xform->eDx = dc->attr->vis_rect.right - dc->attr->vis_rect.left - 1 - xform->eDx;
}
@@ -426,7 +426,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
dc->vport2WorldValid = dcs->vport2WorldValid;
dc->wnd_org = dcs->wnd_org;
dc->wnd_ext = dcs->wnd_ext;
- dc->vport_org = dcs->vport_org;
+ dc->attr->vport_org = dcs->attr->vport_org;
dc->attr->vport_ext = dcs->attr->vport_ext;
dc->virtual_res = dcs->virtual_res;
dc->virtual_size = dcs->virtual_size;
@@ -555,7 +555,6 @@ INT WINAPI NtGdiSaveDC( HDC hdc )
newdc->vport2WorldValid = dc->vport2WorldValid;
newdc->wnd_org = dc->wnd_org;
newdc->wnd_ext = dc->wnd_ext;
- newdc->vport_org = dc->vport_org;
newdc->virtual_res = dc->virtual_res;
newdc->virtual_size = dc->virtual_size;
@@ -1290,19 +1289,6 @@ BOOL WINAPI GetBrushOrgEx( HDC hdc, LPPOINT pt )
}
-/***********************************************************************
- * GetViewportOrgEx (GDI32.@)
- */
-BOOL WINAPI GetViewportOrgEx( HDC hdc, LPPOINT pt )
-{
- DC * dc = get_dc_ptr( hdc );
- if (!dc) return FALSE;
- *pt = dc->vport_org;
- release_dc_ptr( dc );
- return TRUE;
-}
-
-
/***********************************************************************
* GetWindowExtEx (GDI32.@)
*/
diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c
index 34710dd2136..0b8586e8463 100644
--- a/dlls/gdi32/gdidc.c
+++ b/dlls/gdi32/gdidc.c
@@ -353,6 +353,17 @@ BOOL WINAPI GetViewportExtEx( HDC hdc, SIZE *size )
return TRUE;
}
+/***********************************************************************
+ * GetViewportOrgEx (GDI32.@)
+ */
+BOOL WINAPI GetViewportOrgEx( HDC hdc, POINT *point )
+{
+ DC_ATTR *dc_attr;
+ if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
+ *point = dc_attr->vport_org;
+ return TRUE;
+}
+
/***********************************************************************
* SetStretchBltMode (GDI32.@)
*/
diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c
index 6e97a03e02b..d3d7ee60255 100644
--- a/dlls/gdi32/mapping.c
+++ b/dlls/gdi32/mapping.c
@@ -90,11 +90,10 @@ BOOL CDECL nulldrv_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
{
DC *dc = get_nulldrv_dc( dev );
- if (pt)
- *pt = dc->vport_org;
+ if (pt) *pt = dc->attr->vport_org;
- dc->vport_org.x += x;
- dc->vport_org.y += y;
+ dc->attr->vport_org.x += x;
+ dc->attr->vport_org.y += y;
DC_UpdateXforms( dc );
return TRUE;
}
@@ -231,10 +230,10 @@ BOOL CDECL nulldrv_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
DC *dc = get_nulldrv_dc( dev );
if (pt)
- *pt = dc->vport_org;
+ *pt = dc->attr->vport_org;
- dc->vport_org.x = x;
- dc->vport_org.y = y;
+ dc->attr->vport_org.x = x;
+ dc->attr->vport_org.y = y;
DC_UpdateXforms( dc );
return TRUE;
}
diff --git a/dlls/gdi32/ntgdi_private.h b/dlls/gdi32/ntgdi_private.h
index e57f0df03c1..a966aaeb637 100644
--- a/dlls/gdi32/ntgdi_private.h
+++ b/dlls/gdi32/ntgdi_private.h
@@ -89,7 +89,6 @@ typedef struct tagDC
POINT wnd_org; /* Window origin */
SIZE wnd_ext; /* Window extent */
- POINT vport_org; /* Viewport origin */
SIZE virtual_res; /* Initially HORZRES,VERTRES. Changed by SetVirtualResolution */
SIZE virtual_size; /* Initially HORZSIZE,VERTSIZE. Changed by SetVirtualResolution */
RECT device_rect; /* rectangle for the whole device */
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index 52e5df8181a..cf5fb8005af 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -863,7 +863,7 @@ static void test_mf_SaveDC(void)
SetPixelV(hdcMetafile, 50, 50, 0);
ret = GetViewportOrgEx(hdcMetafile, &pt);
- todo_wine ok (!ret, "GetViewportOrgEx should fail\n");
+ ok(!ret, "GetViewportOrgEx should fail\n");
ret = GetViewportExtEx(hdcMetafile, &size);
ok(!ret, "GetViewportExtEx should fail\n");
ret = SaveDC(hdcMetafile);
diff --git a/include/ntgdi.h b/include/ntgdi.h
index f5600b4957a..e2500d924a3 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 vport_org; /* viewport origin */
SIZE vport_ext; /* viewport extent */
void *emf;
} DC_ATTR;
More information about the wine-cvs
mailing list