Thomas Faber : riched20: Simplify ME_PrepareParagraphForWrapping.

Alexandre Julliard julliard at winehq.org
Mon Oct 24 13:43:55 CDT 2011


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

Author: Thomas Faber <thfabba at gmx.de>
Date:   Sat Oct 22 20:30:13 2011 +0200

riched20: Simplify ME_PrepareParagraphForWrapping.

---

 dlls/riched20/wrap.c |   44 +++++++++++++++++---------------------------
 1 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c
index e06db72..cca2cb1 100644
--- a/dlls/riched20/wrap.c
+++ b/dlls/riched20/wrap.c
@@ -481,38 +481,28 @@ static int ME_GetParaLineSpace(ME_Context* c, ME_Paragraph* para)
 }
 
 static void ME_PrepareParagraphForWrapping(ME_Context *c, ME_DisplayItem *tp) {
-  ME_DisplayItem *p, *pRow;
+  ME_DisplayItem *p;
 
   tp->member.para.nWidth = 0;
-  /* remove all items that will be reinserted by paragraph wrapper anyway */
+  /* remove row start items as they will be reinserted by the
+   * paragraph wrapper anyway */
   tp->member.para.nRows = 0;
-  for (p = tp->next; p!=tp->member.para.next_para; p = p->next) {
-    switch(p->type) {
-      case diStartRow:
-        pRow = p;
-        p = p->prev;
-        ME_Remove(pRow);
-        ME_DestroyDisplayItem(pRow);
-        break;
-      default:
-        break;
+  for (p = tp->next; p != tp->member.para.next_para; p = p->next) {
+    if (p->type == diStartRow) {
+      ME_DisplayItem *pRow = p;
+      p = p->prev;
+      ME_Remove(pRow);
+      ME_DestroyDisplayItem(pRow);
     }
   }
-  /* join runs that can be joined, set up flags */
-  for (p = tp->next; p!=tp->member.para.next_para; p = p->next) {
-    switch(p->type) {
-      case diStartRow: assert(0); break; /* should have deleted it */
-      case diRun:
-        while (p->next->type == diRun) { /* FIXME */
-          if (ME_CanJoinRuns(&p->member.run, &p->next->member.run)) {
-            ME_JoinRuns(c->editor, p);
-          }
-          else
-            break;
-        }
-        break;
-      default:
-        break;
+  /* join runs that can be joined */
+  for (p = tp->next; p != tp->member.para.next_para; p = p->next) {
+    assert(p->type != diStartRow); /* should have been deleted above */
+    if (p->type == diRun) {
+      while (p->next->type == diRun && /* FIXME */
+             ME_CanJoinRuns(&p->member.run, &p->next->member.run)) {
+        ME_JoinRuns(c->editor, p);
+      }
     }
   }
 }




More information about the wine-cvs mailing list