gdi32: Fix ExtTextOutA -> W forwarding when ETO_PDY is set.
authorHuw Davies <huw@codeweavers.com>
Wed, 5 May 2010 13:59:07 +0000 (14:59 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Wed, 5 May 2010 15:49:44 +0000 (17:49 +0200)
dlls/gdi32/font.c

index eea53fd2b2f8468c6053320dcbd76f7d24592033..c21036d4f088bb470378930d2b34fb53fc8598de 100644 (file)
@@ -1586,13 +1586,29 @@ BOOL WINAPI ExtTextOutA( HDC hdc, INT x, INT y, UINT flags,
     if (lpDx) {
         unsigned int i = 0, j = 0;
 
-        lpDxW = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(INT));
+        /* allocate enough for a ETO_PDY */
+        lpDxW = HeapAlloc( GetProcessHeap(), 0, 2*wlen*sizeof(INT));
         while(i < count) {
-            if(IsDBCSLeadByteEx(codepage, str[i])) {
-                lpDxW[j++] = lpDx[i] + lpDx[i+1];
+            if(IsDBCSLeadByteEx(codepage, str[i]))
+            {
+                if(flags & ETO_PDY)
+                {
+                    lpDxW[j++] = lpDx[i * 2]     + lpDx[(i + 1) * 2];
+                    lpDxW[j++] = lpDx[i * 2 + 1] + lpDx[(i + 1) * 2 + 1];
+                }
+                else
+                    lpDxW[j++] = lpDx[i] + lpDx[i + 1];
                 i = i + 2;
-            } else {
-                lpDxW[j++] = lpDx[i];
+            }
+            else
+            {
+                if(flags & ETO_PDY)
+                {
+                    lpDxW[j++] = lpDx[i * 2];
+                    lpDxW[j++] = lpDx[i * 2 + 1];
+                }
+                else
+                    lpDxW[j++] = lpDx[i];
                 i = i + 1;
             }
         }