Huw Davies : gdi32: Implement GetTransform for the other valid transform types.
Alexandre Julliard
julliard at winehq.org
Wed Jun 24 09:22:58 CDT 2009
Module: wine
Branch: master
Commit: 6260af2a7cceb77ce240d48b7b9eec44f2ec39cc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6260af2a7cceb77ce240d48b7b9eec44f2ec39cc
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Jun 24 11:42:51 2009 +0100
gdi32: Implement GetTransform for the other valid transform types.
---
dlls/gdi32/dc.c | 75 +++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 59 insertions(+), 16 deletions(-)
diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 30bd7a4..db8a91b 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -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;
}
More information about the wine-cvs
mailing list