Aric Stewart : usp10: Use UpdateClusters in DecomposeVowels.

Alexandre Julliard julliard at winehq.org
Tue Dec 6 15:46:19 CST 2011


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Tue Dec  6 08:48:37 2011 -0600

usp10: Use UpdateClusters in DecomposeVowels.

---

 dlls/usp10/shape.c |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
index 8837213..18380d2 100644
--- a/dlls/usp10/shape.c
+++ b/dlls/usp10/shape.c
@@ -1840,11 +1840,10 @@ static void ReplaceInsertChars(HDC hdc, INT cWalk, INT* pcChars, WCHAR *pwOutCha
     }
 }
 
-static void DecomposeVowels(HDC hdc, WCHAR *pwOutChars, INT *pcChars, const VowelComponents vowels[], WORD* pwLogClust)
+static void DecomposeVowels(HDC hdc, WCHAR *pwOutChars, INT *pcChars, const VowelComponents vowels[], WORD* pwLogClust, INT cChars)
 {
     int i;
     int cWalk;
-    int offset = 0;
 
     for (cWalk = 0; cWalk < *pcChars; cWalk++)
     {
@@ -1852,14 +1851,11 @@ static void DecomposeVowels(HDC hdc, WCHAR *pwOutChars, INT *pcChars, const Vowe
         {
             if (pwOutChars[cWalk] == vowels[i].base)
             {
-                int j;
-                int o = 1;
+                int o = 0;
                 ReplaceInsertChars(hdc, cWalk, pcChars, pwOutChars, vowels[i].parts);
                 if (vowels[i].parts[1]) { cWalk++; o++; }
                 if (vowels[i].parts[2]) { cWalk++; o++; }
-                offset += o;
-                for (j = (cWalk - offset) + 1; j < *pcChars - offset; j ++)
-                    pwLogClust[j]+=o;
+                UpdateClusters(cWalk, o, 1,  cChars,  pwLogClust);
                 break;
             }
         }
@@ -2467,7 +2463,7 @@ static void ContextualShape_Sinhala(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *
     memcpy(input, pwcChars, cChars * sizeof(WCHAR));
 
     /* Step 1:  Decompose multi part vowels */
-    DecomposeVowels(hdc, input,  &cCount, Sinhala_vowels, pwLogClust);
+    DecomposeVowels(hdc, input,  &cCount, Sinhala_vowels, pwLogClust, cChars);
 
     TRACE("New double vowel expanded string %s (%i)\n",debugstr_wn(input,cCount),cCount);
 
@@ -2589,7 +2585,7 @@ static void ContextualShape_Bengali(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *
     memcpy(input, pwcChars, cChars * sizeof(WCHAR));
 
     /* Step 1: Decompose Vowels and Compose Consonents */
-    DecomposeVowels(hdc, input,  &cCount, Bengali_vowels, pwLogClust);
+    DecomposeVowels(hdc, input,  &cCount, Bengali_vowels, pwLogClust, cChars);
     ComposeConsonants(hdc, input, &cCount, Bengali_consonants, pwLogClust);
     TRACE("New composed string %s (%i)\n",debugstr_wn(input,cCount),cCount);
 
@@ -2749,7 +2745,7 @@ static void ContextualShape_Oriya(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *ps
     memcpy(input, pwcChars, cChars * sizeof(WCHAR));
 
     /* Step 1: Decompose Vowels and Compose Consonents */
-    DecomposeVowels(hdc, input,  &cCount, Oriya_vowels, pwLogClust);
+    DecomposeVowels(hdc, input,  &cCount, Oriya_vowels, pwLogClust, cChars);
     ComposeConsonants(hdc, input, &cCount, Oriya_consonants, pwLogClust);
     TRACE("New composed string %s (%i)\n",debugstr_wn(input,cCount),cCount);
 
@@ -2799,7 +2795,7 @@ static void ContextualShape_Tamil(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *ps
     memcpy(input, pwcChars, cChars * sizeof(WCHAR));
 
     /* Step 1: Decompose Vowels and Compose Consonents */
-    DecomposeVowels(hdc, input,  &cCount, Tamil_vowels, pwLogClust);
+    DecomposeVowels(hdc, input,  &cCount, Tamil_vowels, pwLogClust, cChars);
     ComposeConsonants(hdc, input, &cCount, Tamil_consonants, pwLogClust);
     TRACE("New composed string %s (%i)\n",debugstr_wn(input,cCount),cCount);
 
@@ -2849,7 +2845,7 @@ static void ContextualShape_Telugu(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *p
     memcpy(input, pwcChars, cChars * sizeof(WCHAR));
 
     /* Step 1: Decompose Vowels */
-    DecomposeVowels(hdc, input,  &cCount, Telugu_vowels, pwLogClust);
+    DecomposeVowels(hdc, input,  &cCount, Telugu_vowels, pwLogClust, cChars);
     TRACE("New composed string %s (%i)\n",debugstr_wn(input,cCount),cCount);
 
     /* Step 2: Reorder within Syllables */
@@ -2901,7 +2897,7 @@ static void ContextualShape_Kannada(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *
     memcpy(input, pwcChars, cChars * sizeof(WCHAR));
 
     /* Step 1: Decompose Vowels */
-    DecomposeVowels(hdc, input,  &cCount, Kannada_vowels, pwLogClust);
+    DecomposeVowels(hdc, input,  &cCount, Kannada_vowels, pwLogClust, cChars);
     TRACE("New composed string %s (%i)\n",debugstr_wn(input,cCount),cCount);
 
     /* Step 2: Reorder within Syllables */
@@ -2946,7 +2942,7 @@ static void ContextualShape_Malayalam(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS
     memcpy(input, pwcChars, cChars * sizeof(WCHAR));
 
     /* Step 1: Decompose Vowels */
-    DecomposeVowels(hdc, input,  &cCount, Malayalam_vowels, pwLogClust);
+    DecomposeVowels(hdc, input,  &cCount, Malayalam_vowels, pwLogClust, cChars);
     TRACE("New composed string %s (%i)\n",debugstr_wn(input,cCount),cCount);
 
     /* Step 2: Reorder within Syllables */




More information about the wine-cvs mailing list