Commit 215a352e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Store window extent in DC_ATTR.

parent 3a0d08d2
......@@ -233,8 +233,8 @@ INT CDECL nulldrv_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
if (dc->hClipRgn)
{
x = MulDiv( x, dc->attr->vport_ext.cx, dc->wnd_ext.cx );
y = MulDiv( y, dc->attr->vport_ext.cy, dc->wnd_ext.cy );
x = MulDiv( x, dc->attr->vport_ext.cx, dc->attr->wnd_ext.cx );
y = MulDiv( y, dc->attr->vport_ext.cy, dc->attr->wnd_ext.cy );
if (dc->attr->layout & LAYOUT_RTL) x = -x;
ret = NtGdiOffsetRgn( dc->hClipRgn, x, y );
update_dc_clipping( dc );
......
......@@ -73,8 +73,8 @@ static void set_initial_dc_state( DC *dc )
{
dc->attr->wnd_org.x = 0;
dc->attr->wnd_org.y = 0;
dc->wnd_ext.cx = 1;
dc->wnd_ext.cy = 1;
dc->attr->wnd_ext.cx = 1;
dc->attr->wnd_ext.cy = 1;
dc->attr->vport_org.x = 0;
dc->attr->vport_org.y = 0;
dc->attr->vport_ext.cx = 1;
......@@ -319,8 +319,8 @@ static BOOL DC_InvertXform( const XFORM *xformSrc, XFORM *xformDest )
static void construct_window_to_viewport(DC *dc, XFORM *xform)
{
double scaleX, scaleY;
scaleX = (double)dc->attr->vport_ext.cx / (double)dc->wnd_ext.cx;
scaleY = (double)dc->attr->vport_ext.cy / (double)dc->wnd_ext.cy;
scaleX = (double)dc->attr->vport_ext.cx / (double)dc->attr->wnd_ext.cx;
scaleY = (double)dc->attr->vport_ext.cy / (double)dc->attr->wnd_ext.cy;
if (dc->attr->layout & LAYOUT_RTL) scaleX = -scaleX;
xform->eM11 = scaleX;
......@@ -425,7 +425,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
dc->xformVport2World = dcs->xformVport2World;
dc->vport2WorldValid = dcs->vport2WorldValid;
dc->attr->wnd_org = dcs->attr->wnd_org;
dc->wnd_ext = dcs->wnd_ext;
dc->attr->wnd_ext = dcs->attr->wnd_ext;
dc->attr->vport_org = dcs->attr->vport_org;
dc->attr->vport_ext = dcs->attr->vport_ext;
dc->virtual_res = dcs->virtual_res;
......@@ -553,7 +553,6 @@ INT WINAPI NtGdiSaveDC( HDC hdc )
newdc->xformWorld2Vport = dc->xformWorld2Vport;
newdc->xformVport2World = dc->xformVport2World;
newdc->vport2WorldValid = dc->vport2WorldValid;
newdc->wnd_ext = dc->wnd_ext;
newdc->virtual_res = dc->virtual_res;
newdc->virtual_size = dc->virtual_size;
......@@ -1289,19 +1288,6 @@ BOOL WINAPI GetBrushOrgEx( HDC hdc, LPPOINT pt )
/***********************************************************************
* GetWindowExtEx (GDI32.@)
*/
BOOL WINAPI GetWindowExtEx( HDC hdc, LPSIZE size )
{
DC * dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
*size = dc->wnd_ext;
release_dc_ptr( dc );
return TRUE;
}
/***********************************************************************
* SetLayout (GDI32.@)
*
* Sets left->right or right->left text layout flags of a dc.
......
......@@ -4791,7 +4791,8 @@ BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks )
ret = physdev->funcs->pSetTextJustification( physdev, extra, breaks );
if (ret)
{
extra = abs((extra * dc->attr->vport_ext.cx + dc->wnd_ext.cx / 2) / dc->wnd_ext.cx);
extra = abs( (extra * dc->attr->vport_ext.cx + dc->attr->wnd_ext.cx / 2) /
dc->attr->wnd_ext.cx );
if (!extra) breaks = 0;
if (breaks)
{
......
......@@ -343,6 +343,17 @@ BOOL WINAPI GetDCOrgEx( HDC hdc, POINT *point )
}
/***********************************************************************
* GetWindowExtEx (GDI32.@)
*/
BOOL WINAPI GetWindowExtEx( HDC hdc, SIZE *size )
{
DC_ATTR *dc_attr;
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
*size = dc_attr->wnd_ext;
return TRUE;
}
/***********************************************************************
* GetWindowOrgEx (GDI32.@)
*/
BOOL WINAPI GetWindowOrgEx( HDC hdc, POINT *point )
......
......@@ -63,9 +63,9 @@ static void MAPPING_FixIsotropic( DC * dc )
SIZE virtual_size = get_dc_virtual_size( dc );
SIZE virtual_res = get_dc_virtual_res( dc );
double xdim = fabs((double)dc->attr->vport_ext.cx * virtual_size.cx /
(virtual_res.cx * dc->wnd_ext.cx));
(virtual_res.cx * dc->attr->wnd_ext.cx));
double ydim = fabs((double)dc->attr->vport_ext.cy * virtual_size.cy /
(virtual_res.cy * dc->wnd_ext.cy));
(virtual_res.cy * dc->attr->wnd_ext.cy));
if (xdim > ydim)
{
......@@ -135,15 +135,15 @@ BOOL CDECL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_
DC *dc = get_nulldrv_dc( dev );
if (size)
*size = dc->wnd_ext;
*size = dc->attr->wnd_ext;
if (dc->attr->map_mode != MM_ISOTROPIC && dc->attr->map_mode != MM_ANISOTROPIC) return TRUE;
if (!x_num || !x_denom || !y_num || !y_denom) return FALSE;
dc->wnd_ext.cx = (dc->wnd_ext.cx * x_num) / x_denom;
dc->wnd_ext.cy = (dc->wnd_ext.cy * y_num) / y_denom;
if (dc->wnd_ext.cx == 0) dc->wnd_ext.cx = 1;
if (dc->wnd_ext.cy == 0) dc->wnd_ext.cy = 1;
dc->attr->wnd_ext.cx = (dc->attr->wnd_ext.cx * x_num) / x_denom;
dc->attr->wnd_ext.cy = (dc->attr->wnd_ext.cy * y_num) / y_denom;
if (dc->attr->wnd_ext.cx == 0) dc->attr->wnd_ext.cx = 1;
if (dc->attr->wnd_ext.cy == 0) dc->attr->wnd_ext.cy = 1;
if (dc->attr->map_mode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc );
DC_UpdateXforms( dc );
return TRUE;
......@@ -162,39 +162,39 @@ INT CDECL nulldrv_SetMapMode( PHYSDEV dev, INT mode )
switch (mode)
{
case MM_TEXT:
dc->wnd_ext.cx = 1;
dc->wnd_ext.cy = 1;
dc->attr->wnd_ext.cx = 1;
dc->attr->wnd_ext.cy = 1;
dc->attr->vport_ext.cx = 1;
dc->attr->vport_ext.cy = 1;
break;
case MM_LOMETRIC:
case MM_ISOTROPIC:
dc->wnd_ext.cx = virtual_size.cx * 10;
dc->wnd_ext.cy = virtual_size.cy * 10;
dc->attr->wnd_ext.cx = virtual_size.cx * 10;
dc->attr->wnd_ext.cy = virtual_size.cy * 10;
dc->attr->vport_ext.cx = virtual_res.cx;
dc->attr->vport_ext.cy = -virtual_res.cy;
break;
case MM_HIMETRIC:
dc->wnd_ext.cx = virtual_size.cx * 100;
dc->wnd_ext.cy = virtual_size.cy * 100;
dc->attr->wnd_ext.cx = virtual_size.cx * 100;
dc->attr->wnd_ext.cy = virtual_size.cy * 100;
dc->attr->vport_ext.cx = virtual_res.cx;
dc->attr->vport_ext.cy = -virtual_res.cy;
break;
case MM_LOENGLISH:
dc->wnd_ext.cx = MulDiv(1000, virtual_size.cx, 254);
dc->wnd_ext.cy = MulDiv(1000, virtual_size.cy, 254);
dc->attr->wnd_ext.cx = MulDiv(1000, virtual_size.cx, 254);
dc->attr->wnd_ext.cy = MulDiv(1000, virtual_size.cy, 254);
dc->attr->vport_ext.cx = virtual_res.cx;
dc->attr->vport_ext.cy = -virtual_res.cy;
break;
case MM_HIENGLISH:
dc->wnd_ext.cx = MulDiv(10000, virtual_size.cx, 254);
dc->wnd_ext.cy = MulDiv(10000, virtual_size.cy, 254);
dc->attr->wnd_ext.cx = MulDiv(10000, virtual_size.cx, 254);
dc->attr->wnd_ext.cy = MulDiv(10000, virtual_size.cy, 254);
dc->attr->vport_ext.cx = virtual_res.cx;
dc->attr->vport_ext.cy = -virtual_res.cy;
break;
case MM_TWIPS:
dc->wnd_ext.cx = MulDiv(14400, virtual_size.cx, 254);
dc->wnd_ext.cy = MulDiv(14400, virtual_size.cy, 254);
dc->attr->wnd_ext.cx = MulDiv(14400, virtual_size.cx, 254);
dc->attr->wnd_ext.cy = MulDiv(14400, virtual_size.cy, 254);
dc->attr->vport_ext.cx = virtual_res.cx;
dc->attr->vport_ext.cy = -virtual_res.cy;
break;
......@@ -243,12 +243,12 @@ BOOL CDECL nulldrv_SetWindowExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size )
DC *dc = get_nulldrv_dc( dev );
if (size)
*size = dc->wnd_ext;
*size = dc->attr->wnd_ext;
if (dc->attr->map_mode != MM_ISOTROPIC && dc->attr->map_mode != MM_ANISOTROPIC) return TRUE;
if (!cx || !cy) return FALSE;
dc->wnd_ext.cx = cx;
dc->wnd_ext.cy = cy;
dc->attr->wnd_ext.cx = cx;
dc->attr->wnd_ext.cy = cy;
/* The API docs say that you should call SetWindowExtEx before
SetViewportExtEx. This advice does not imply that Windows
doesn't ensure the isotropic mapping after SetWindowExtEx! */
......
......@@ -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) */
SIZE wnd_ext; /* Window extent */
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 */
......
......@@ -117,6 +117,7 @@ typedef struct DC_ATTR
RECT vis_rect; /* visible rectangle in screen coords */
FLOAT miter_limit;
POINT wnd_org; /* window origin */
SIZE wnd_ext; /* window extent */
POINT vport_org; /* viewport origin */
SIZE vport_ext; /* viewport extent */
void *emf;
......
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