[3/3] gdi32: Fix text rotation problem in GM_ADVANCED graphics, mode. (try 2)

Ralf Habacker ralf.habacker at freenet.de
Thu Jan 9 07:00:46 CST 2014


>From a7387299d4476080358925a40f435110a0ffead6 Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker at freenet.de>
Date: Mon, 30 Sep 2013 11:04:37 +0200
Subject: [3/3] gdi32: Fix text rotation problem in GM_ADVANCED graphics
 mode.

Bug: http://bugs.winehq.org/show_bug.cgi?id=33190
---
 dlls/gdi32/font.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index a025d17..c3a3f6c 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -1327,6 +1327,22 @@ BOOL WINAPI GetTextExtentExPointW( HDC hdc,
LPCWSTR str, INT count, INT max_ext,
         }
     }

+    BOOL restore_transform = FALSE;
+    XFORM old;
+
+    if (GetGraphicsMode( hdc ) == GM_ADVANCED)
+    {
+        XFORM xf;
+        GetWorldTransform( hdc, &old );
+        xf = old;
+        if (xform_has_rotate_and_uniform_scale_and_shear( &xf ) &&
+            xform_decompose_rotation_and_translation( &xf, NULL ))
+        {
+            SetWorldTransform( hdc, &xf );
+            restore_transform = TRUE;
+        }
+    }
+
     ret = get_char_positions( dc, str, count, pos, size );
     if (ret)
     {
@@ -1348,6 +1364,11 @@ BOOL WINAPI GetTextExtentExPointW( HDC hdc,
LPCWSTR str, INT count, INT max_ext,
     if (pos != buffer && pos != dxs) HeapFree( GetProcessHeap(), 0, pos );
     release_dc_ptr( dc );

+    if (restore_transform == TRUE)
+    {
+        SetWorldTransform( hdc, &old );
+    }
+
     TRACE("(%p, %s, %d) returning %dx%d\n", hdc,
debugstr_wn(str,count), max_ext, size->cx, size->cy );
     return ret;
 }
-- 
1.8.4




More information about the wine-patches mailing list