Jacek Caban : gdi32: Support MWT_SET in NtGdiModifyWorldTransform.

Alexandre Julliard julliard at winehq.org
Fri Aug 13 14:44:14 CDT 2021


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Aug 13 12:08:00 2021 +0200

gdi32: Support MWT_SET in NtGdiModifyWorldTransform.

It's not defined in public headers, but it's documented in EMF spec.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/mapping.c       |  5 +++++
 dlls/gdi32/tests/mapping.c | 22 ++++++++++++++++++++++
 include/ntgdi.h            |  2 ++
 3 files changed, 29 insertions(+)

diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c
index d30d98b8592..381c29dd26f 100644
--- a/dlls/gdi32/mapping.c
+++ b/dlls/gdi32/mapping.c
@@ -366,6 +366,11 @@ BOOL WINAPI NtGdiModifyWorldTransform( HDC hdc, const XFORM *xform, DWORD mode )
         case MWT_RIGHTMULTIPLY:
             ret = CombineTransform( &dc->xformWorld2Wnd, &dc->xformWorld2Wnd, xform );
             break;
+        case MWT_SET:
+            ret = dc->attr->graphics_mode == GM_ADVANCED &&
+                xform->eM11 * xform->eM22 != xform->eM12 * xform->eM21;
+            if (ret) dc->xformWorld2Wnd = *xform;
+            break;
         }
         if (ret) DC_UpdateXforms( dc );
         release_dc_ptr( dc );
diff --git a/dlls/gdi32/tests/mapping.c b/dlls/gdi32/tests/mapping.c
index fece9da94dc..90c9d5a6617 100644
--- a/dlls/gdi32/tests/mapping.c
+++ b/dlls/gdi32/tests/mapping.c
@@ -385,6 +385,7 @@ static void test_dc_layout(void)
 static void test_modify_world_transform(void)
 {
     HDC hdc = GetDC(0);
+    XFORM xform, xform2;
     int ret;
 
     ret = SetGraphicsMode(hdc, GM_ADVANCED);
@@ -399,6 +400,27 @@ static void test_modify_world_transform(void)
     ret = ModifyWorldTransform(hdc, NULL, MWT_RIGHTMULTIPLY);
     ok(!ret, "ret = %d\n", ret);
 
+    xform.eM11 = 2;
+    xform.eM12 = 0;
+    xform.eM21 = 0;
+    xform.eM22 = 1;
+    xform.eDx = xform.eDy = 0;
+    ret = ModifyWorldTransform(hdc, &xform, 4);
+    ok(ret, "ModifyWorldTransform failed\n");
+
+    memset(&xform2, 0xcc, sizeof(xform2));
+    ret = GetWorldTransform(hdc, &xform2);
+    ok(ret, "GetWorldTransform failed\n");
+    ok(!memcmp(&xform, &xform2, sizeof(xform)), "unexpected xform\n");
+
+    xform.eM11 = 1;
+    xform.eM12 = 1;
+    xform.eM21 = 1;
+    xform.eM22 = 1;
+    xform.eDx = xform.eDy = 0;
+    ret = ModifyWorldTransform(hdc, &xform, 4);
+    ok(!ret, "ModifyWorldTransform succeeded\n");
+
     ReleaseDC(0, hdc);
 }
 
diff --git a/include/ntgdi.h b/include/ntgdi.h
index 9aeaea5d3cb..9132d606c43 100644
--- a/include/ntgdi.h
+++ b/include/ntgdi.h
@@ -105,6 +105,8 @@ enum
     NtGdiSetMapMode = 8,
 };
 
+#define MWT_SET  4
+
 /* structs not compatible with native Windows */
 #ifdef __WINESRC__
 




More information about the wine-cvs mailing list