Commit 6260af2a authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: Implement GetTransform for the other valid transform types.

parent c87200f6
......@@ -284,6 +284,20 @@ static BOOL DC_InvertXform( const XFORM *xformSrc, XFORM *xformDest )
return TRUE;
}
/* Construct a transformation to do the window-to-viewport conversion */
static void construct_window_to_viewport(DC *dc, XFORM *xform)
{
double scaleX, scaleY;
scaleX = (double)dc->vportExtX / (double)dc->wndExtX;
scaleY = (double)dc->vportExtY / (double)dc->wndExtY;
xform->eM11 = scaleX;
xform->eM12 = 0.0;
xform->eM21 = 0.0;
xform->eM22 = scaleY;
xform->eDx = (double)dc->vportOrgX - scaleX * (double)dc->wndOrgX;
xform->eDy = (double)dc->vportOrgY - scaleY * (double)dc->wndOrgY;
}
/***********************************************************************
* DC_UpdateXforms
......@@ -298,19 +312,8 @@ static BOOL DC_InvertXform( const XFORM *xformSrc, XFORM *xformDest )
void DC_UpdateXforms( DC *dc )
{
XFORM xformWnd2Vport, oldworld2vport;
double scaleX, scaleY;
/* Construct a transformation to do the window-to-viewport conversion */
scaleX = (double)dc->vportExtX / (double)dc->wndExtX;
scaleY = (double)dc->vportExtY / (double)dc->wndExtY;
xformWnd2Vport.eM11 = scaleX;
xformWnd2Vport.eM12 = 0.0;
xformWnd2Vport.eM21 = 0.0;
xformWnd2Vport.eM22 = scaleY;
xformWnd2Vport.eDx = (double)dc->vportOrgX -
scaleX * (double)dc->wndOrgX;
xformWnd2Vport.eDy = (double)dc->vportOrgY -
scaleY * (double)dc->wndOrgY;
construct_window_to_viewport(dc, &xformWnd2Vport);
oldworld2vport = dc->xformWorld2Vport;
/* Combine with the world transformation */
......@@ -1164,12 +1167,52 @@ BOOL WINAPI GetWorldTransform( HDC hdc, LPXFORM xform )
/***********************************************************************
* GetTransform (GDI32.@)
*
* Undocumented
*
* Returns one of the co-ordinate space transforms
*
* PARAMS
* hdc [I] Device context.
* which [I] Which xform to return:
* 0x203 World -> Page transform (that set by SetWorldTransform).
* 0x304 Page -> Device transform (the mapping mode transform).
* 0x204 World -> Device transform (the combination of the above two).
* 0x402 Device -> World transform (the inversion of the above).
* xform [O] The xform.
*
*/
BOOL WINAPI GetTransform( HDC hdc, DWORD unknown, LPXFORM xform )
BOOL WINAPI GetTransform( HDC hdc, DWORD which, XFORM *xform )
{
if (unknown == 0x0203) return GetWorldTransform( hdc, xform );
FIXME("stub: don't know what to do for code %x\n", unknown );
return FALSE;
BOOL ret = TRUE;
DC *dc = get_dc_ptr( hdc );
if (!dc) return FALSE;
switch(which)
{
case 0x203:
*xform = dc->xformWorld2Wnd;
break;
case 0x304:
construct_window_to_viewport(dc, xform);
break;
case 0x204:
*xform = dc->xformWorld2Vport;
break;
case 0x402:
*xform = dc->xformVport2World;
break;
default:
FIXME("Unknown code %x\n", which);
ret = FALSE;
}
release_dc_ptr( dc );
return ret;
}
......
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