Commit e349a4a1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Store viewport origin in DC_ATTR.

parent 81dbf2db
......@@ -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;
......@@ -1291,19 +1290,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.@)
*/
BOOL WINAPI GetWindowExtEx( HDC hdc, LPSIZE size )
......
......@@ -354,6 +354,17 @@ BOOL WINAPI GetViewportExtEx( HDC hdc, SIZE *size )
}
/***********************************************************************
* 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.@)
*/
INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
......
......@@ -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;
}
......
......@@ -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 */
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment