Huw Davies : riched20: Simplify the code by accessing paragraphs directly from runs.

Alexandre Julliard julliard at winehq.org
Tue Jan 7 13:21:18 CST 2014


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Jan  7 12:44:20 2014 +0000

riched20: Simplify the code by accessing paragraphs directly from runs.

---

 dlls/riched20/run.c |   22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
index 263fee4..245a031 100644
--- a/dlls/riched20/run.c
+++ b/dlls/riched20/run.c
@@ -658,9 +658,7 @@ void ME_SetSelectionCharFormat(ME_TextEditor *editor, CHARFORMAT2W *pFmt)
  */
 void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, CHARFORMAT2W *pFmt)
 {
-  ME_DisplayItem *para;
-  ME_DisplayItem *run;
-  ME_DisplayItem *end_run = NULL;
+  ME_DisplayItem *run, *end_run = NULL;
 
   if (end && start->pRun == end->pRun && start->nOffset == end->nOffset)
     return;
@@ -682,27 +680,15 @@ void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, C
     ME_SplitRunSimple(editor, end);
   end_run = end ? end->pRun : NULL;
 
-  run = start->pRun;
-  para = start->pPara;
-  para->member.para.nFlags |= MEPF_REWRAP;
-
-  while(run != end_run)
+  for (run = start->pRun; run != end_run; run = ME_FindItemFwd( run, diRun ))
   {
     ME_Style *new_style = ME_ApplyStyle(run->member.run.style, pFmt);
-    /* ME_DumpStyle(new_style); */
 
-    add_undo_set_char_fmt( editor, para->member.para.nCharOfs + run->member.run.nCharOfs,
+    add_undo_set_char_fmt( editor, run->member.run.para->nCharOfs + run->member.run.nCharOfs,
                            run->member.run.len, &run->member.run.style->fmt );
     ME_ReleaseStyle(run->member.run.style);
     run->member.run.style = new_style;
-    run = ME_FindItemFwd(run, diRunOrParagraph);
-    if (run && run->type == diParagraph)
-    {
-      para = run;
-      run = ME_FindItemFwd(run, diRun);
-      if (run != end_run)
-        para->member.para.nFlags |= MEPF_REWRAP;
-    }
+    run->member.run.para->nFlags |= MEPF_REWRAP;
   }
 }
 




More information about the wine-cvs mailing list