riched20: Use SetRect instead of open coding it.

Michael Stefaniuc mstefani at redhat.de
Mon Apr 18 03:11:33 CDT 2016


Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
---
 dlls/riched20/paint.c   | 18 ++++++------------
 dlls/riched20/richole.c |  5 +----
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index f893061..1e47ba8 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -617,10 +617,8 @@ static void ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, RECT
       MoveToEx(c->hDC, c->pt.x, y + bounds->top, NULL);
       LineTo(c->hDC, c->pt.x, y + para->nHeight - bounds->bottom);
       if (border_details[idx].dble) {
-        rc.left = c->pt.x + 1;
-        rc.right = rc.left + border_width;
-        rc.top = y + bounds->top;
-        rc.bottom = y + para->nHeight - bounds->bottom;
+        SetRect(&rc, c->pt.x + 1, y + bounds->top, rc.left + border_width,
+                y + para->nHeight - bounds->bottom);
         FillRect(c->hDC, &rc, c->editor->hbrBackground);
         MoveToEx(c->hDC, c->pt.x + pen_width + 1, y + bounds->top + DD(4), NULL);
         LineTo(c->hDC, c->pt.x + pen_width + 1, y + para->nHeight - bounds->bottom - DD(8));
@@ -632,10 +630,8 @@ static void ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, RECT
       MoveToEx(c->hDC, rightEdge - 1, y + bounds->top, NULL);
       LineTo(c->hDC, rightEdge - 1, y + para->nHeight - bounds->bottom);
       if (border_details[idx].dble) {
-        rc.left = rightEdge - pen_width - 1;
-        rc.right = rc.left + pen_width;
-        rc.top = y + bounds->top;
-        rc.bottom = y + para->nHeight - bounds->bottom;
+        SetRect(&rc, rightEdge - pen_width - 1, y + bounds->top, rc.left + pen_width,
+                y + para->nHeight - bounds->bottom);
         FillRect(c->hDC, &rc, c->editor->hbrBackground);
         MoveToEx(c->hDC, rightEdge - 1 - pen_width - 1, y + bounds->top + DD(4), NULL);
         LineTo(c->hDC, rightEdge - 1 - pen_width - 1, y + para->nHeight - bounds->bottom - DD(8));
@@ -952,10 +948,8 @@ static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph)
         run = &p->member.run;
         if (visible && me_debug) {
           RECT rc;
-          rc.left = c->pt.x + run->pt.x;
-          rc.right = rc.left + run->nWidth;
-          rc.top = c->pt.y + para->pt.y + run->pt.y;
-          rc.bottom = rc.top + height;
+          SetRect(&rc, c->pt.x + run->pt.x, c->pt.y + para->pt.y + run->pt.y, rc.left + run->nWidth,
+                  rc.top + height);
           TRACE("rc = (%d, %d, %d, %d)\n", rc.left, rc.top, rc.right, rc.bottom);
           FrameRect(c->hDC, &rc, GetSysColorBrush(COLOR_GRAYTEXT));
         }
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 1013e67..f32421c 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -5414,10 +5414,7 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
     {
       RECT    rc;
 
-      rc.left = x;
-      rc.top = y - sz.cy;
-      rc.right = x + sz.cx;
-      rc.bottom = y;
+      SetRect(&rc, x, y - sz.cy, x + sz.cx, y);
       PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc);
     }
     if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
-- 
2.4.11



More information about the wine-patches mailing list