Erich Hoover : oleaut32: Fix OLEPicture rendering vector metafiles without setting up the source rectangle .

Alexandre Julliard julliard at winehq.org
Tue Jan 20 08:27:41 CST 2009


Module: wine
Branch: master
Commit: a82cdfc05016dffb9f8f649e9f00c675afd0e681
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a82cdfc05016dffb9f8f649e9f00c675afd0e681

Author: Erich Hoover <ehoover at mines.edu>
Date:   Mon Jan 19 19:50:03 2009 -0700

oleaut32: Fix OLEPicture rendering vector metafiles without setting up the source rectangle.

---

 dlls/oleaut32/olepicture.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index c80f357..f05501d 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -710,17 +710,27 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
 
   case PICTYPE_METAFILE:
   {
-    POINT prevOrg;
-    SIZE prevExt;
+    POINT prevOrg, prevWndOrg;
+    SIZE prevExt, prevWndExt;
     int oldmode;
 
+    /* Render the WMF to the appropriate location by setting the
+       appropriate ratio between "device units" and "logical units" */
     oldmode = SetMapMode(hdc, MM_ANISOTROPIC);
+    /* For the "source rectangle" the y-axis must be inverted */
+    SetWindowOrgEx(hdc, xSrc, This->himetricHeight-ySrc, &prevWndOrg);
+    SetWindowExtEx(hdc, cxSrc, -cySrc, &prevWndExt);
+    /* For the "destination rectangle" no inversion is necessary */
     SetViewportOrgEx(hdc, x, y, &prevOrg);
     SetViewportExtEx(hdc, cx, cy, &prevExt);
 
     if (!PlayMetaFile(hdc, This->desc.u.wmf.hmeta))
         ERR("PlayMetaFile failed!\n");
 
+    /* We're done, restore the DC to the previous settings for converting
+       logical units to device units */
+    SetWindowExtEx(hdc, prevWndExt.cx, prevWndExt.cy, NULL);
+    SetWindowOrgEx(hdc, prevWndOrg.x, prevWndOrg.y, NULL);
     SetViewportExtEx(hdc, prevExt.cx, prevExt.cy, NULL);
     SetViewportOrgEx(hdc, prevOrg.x, prevOrg.y, NULL);
     SetMapMode(hdc, oldmode);




More information about the wine-cvs mailing list