Huw Davies : usp10: Simplify the offset calculation by always using ETO_PDY .

Alexandre Julliard julliard at winehq.org
Tue Jan 8 13:58:44 CST 2013


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Jan  8 16:05:31 2013 +0000

usp10: Simplify the offset calculation by always using ETO_PDY.

---

 dlls/usp10/usp10.c |   40 +++++++++-------------------------------
 1 files changed, 9 insertions(+), 31 deletions(-)

diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index 6ff640e..75fe597 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -3253,41 +3253,19 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN
         fuOptions |= ETO_GLYPH_INDEX;                             /* Say don't do translation to glyph */
 
     lpDx = heap_alloc(cGlyphs * sizeof(INT) * 2);
+    fuOptions |= ETO_PDY;
 
-    if (pGoffset)
-    {
-        for (i = 0; i < cGlyphs; i++)
-            if (!(fuOptions&ETO_PDY) && pGoffset[i].dv)
-                fuOptions |= ETO_PDY;
-    }
     for (i = 0; i < cGlyphs; i++)
     {
-        int idx = i;
-        if (fuOptions&ETO_PDY)
-        {
-            idx *=2;
-            lpDx[idx+1] = 0;
-        }
-        lpDx[idx] = piAdvance[i];
-    }
-    if (pGoffset)
-    {
-        for (i = 1; i < cGlyphs; i++)
+        lpDx[i * 2] = piAdvance[i];
+        lpDx[i * 2 + 1] = 0;
+
+        if (pGoffset && i > 0)
         {
-            int idx = i;
-            int prev_idx = i-1;
-            if (fuOptions&ETO_PDY)
-            {
-                idx*=2;
-                prev_idx = idx-2;
-            }
-            lpDx[prev_idx] += pGoffset[i].du;
-            lpDx[idx] -= pGoffset[i].du;
-            if (fuOptions&ETO_PDY)
-            {
-                lpDx[prev_idx+1] += pGoffset[i].dv;
-                lpDx[idx+1] -= pGoffset[i].dv;
-            }
+            lpDx[(i - 1) * 2]     += pGoffset[i].du;
+            lpDx[(i - 1) * 2 + 1] += pGoffset[i].dv;
+            lpDx[i * 2]           -= pGoffset[i].du;
+            lpDx[i * 2 + 1]       -= pGoffset[i].dv;
         }
     }
 




More information about the wine-cvs mailing list