[PATCH] gdi: Fix meaning and use of bidirectionality flags

Maarten Lankhorst maarten at codeweavers.com
Thu Sep 27 03:41:58 CDT 2007


---
 dlls/gdi32/bidi.c        |   29 ++++++++++-------------------
 dlls/gdi32/gdi_private.h |    6 ++++--
 2 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/dlls/gdi32/bidi.c b/dlls/gdi32/bidi.c
index adffedc..fd0df99 100644
--- a/dlls/gdi32/bidi.c
+++ b/dlls/gdi32/bidi.c
@@ -1054,7 +1054,7 @@ BOOL BIDI_Reorder(
 {
     WORD *levels;
     WORD *chartype;
-    unsigned i, baselevel = 0, forcedir = 0, done;
+    unsigned i, baselevel = 0, done;
     TRACE("%s, %d, 0x%08x lpOutString=%p, lpOrder=%p\n",
           debugstr_wn(lpString, uCount), uCount, dwFlags,
           lpOutString, lpOrder);
@@ -1081,14 +1081,8 @@ BOOL BIDI_Reorder(
 
     memcpy(lpOutString, lpString, uCount * sizeof(WCHAR));
 
-    switch (dwWineGCP_Flags&WINE_GCPW_DIR_MASK)
-    {
-    /* force means initial level is set directly,
-     * loose means initial level is determined by first character that has a direction */
-    case WINE_GCPW_FORCE_LTR: forcedir = L; break;
-    case WINE_GCPW_FORCE_RTL: forcedir = R; baselevel = 1; break;
-    default: break;
-    }
+    if (WINE_GCPW_FORCE_RTL == (dwWineGCP_Flags&WINE_GCPW_DIR_MASK))
+        baselevel = 1;
 
     i = done = 0;
     while (done < uCount)
@@ -1107,29 +1101,26 @@ BOOL BIDI_Reorder(
                 default: continue;
             }
 
-        if (!forcedir)
-        {
-            if ((dwWineGCP_Flags&WINE_GCPW_DIR_MASK) == WINE_GCPW_LOOSE_RTL)
-                baselevel = 1;
-            else baselevel = 0;
+        if ((dwWineGCP_Flags&WINE_GCPW_DIR_MASK) == WINE_GCPW_LOOSE_RTL)
+            baselevel = 1;
+        else if ((dwWineGCP_Flags&WINE_GCPW_DIR_MASK) == WINE_GCPW_LOOSE_LTR)
+            baselevel = 0;
 
+        if (dwWineGCP_Flags & WINE_GCPW_LOOSE_MASK)
             for (j = 0; j < i; ++j)
-            {
                 if (chartype[j] == L)
                 {
                     baselevel = 0;
                     break;
                 }
-                if (chartype[j] == R)
+                else if (chartype[j] == R)
                 {
                     baselevel = 1;
                     break;
                 }
-            }
-        }
 
         /* resolve explicit */
-        resolveExplicit(baselevel, forcedir, chartype, levels, i, 0);
+        resolveExplicit(baselevel, N, chartype, levels, i, 0);
 
         /* resolve weak */
         resolveWeak(baselevel, chartype, levels, i);
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 157a7de..102f948 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -373,14 +373,16 @@ typedef struct tagBITMAPOBJ
 
 /* Wine_GCPW Flags */
 /* Directionality -
- * LOOSE means that the paragraph dir is only set if there is no strong character.
- * FORCE means override the characters in the paragraph.
+ * LOOSE means taking the directionality of the first strong character, if there is found one.
+ * FORCE means the paragraph direction is forced. (RLE/LRE)
  */
 #define WINE_GCPW_FORCE_LTR 0
 #define WINE_GCPW_FORCE_RTL 1
 #define WINE_GCPW_LOOSE_LTR 2
 #define WINE_GCPW_LOOSE_RTL 3
 #define WINE_GCPW_DIR_MASK 3
+#define WINE_GCPW_LOOSE_MASK 2
+
 extern BOOL BIDI_Reorder( LPCWSTR lpString, INT uCount, DWORD dwFlags, DWORD dwWineGCP_Flags,
                           LPWSTR lpOutString, INT uCountOut, UINT *lpOrder );
 
-- 
1.5.2.5


--------------010705000308050603020809--



More information about the wine-patches mailing list