Michael Stefaniuc : taskmgr: Use SetRect() instead of open coding it.

Alexandre Julliard julliard at winehq.org
Thu Jul 14 08:58:05 CDT 2016


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Wed Jul 13 09:52:13 2016 +0200

taskmgr: Use SetRect() instead of open coding it.

Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/taskmgr/graphctl.c | 16 ++++------------
 programs/taskmgr/taskmgr.c  |  5 +----
 programs/taskmgr/trayicon.c |  5 +----
 3 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/programs/taskmgr/graphctl.c b/programs/taskmgr/graphctl.c
index 70051eb..214cd75 100644
--- a/programs/taskmgr/graphctl.c
+++ b/programs/taskmgr/graphctl.c
@@ -117,10 +117,7 @@ static void GraphCtrl_Resize(TGraphCtrl* this)
 
     /*  the "left" coordinate and "width" will be modified in  */
     /*  InvalidateCtrl to be based on the width of the y axis scaling */
-    this->m_rectPlot.left   = 0;
-    this->m_rectPlot.top    = -1;
-    this->m_rectPlot.right  = this->m_rectClient.right-0;
-    this->m_rectPlot.bottom = this->m_rectClient.bottom-0;
+    SetRect(&this->m_rectPlot, 0, -1, this->m_rectClient.right, this->m_rectClient.bottom);
 
     /*  set some member variables to avoid multiple function calls */
     this->m_nPlotHeight = this->m_rectPlot.bottom - this->m_rectPlot.top;/* m_rectPlot.Height(); */
@@ -340,19 +337,14 @@ static void GraphCtrl_DrawPoint(TGraphCtrl* this)
             if ((prevY <= this->m_rectPlot.top) || (currY <= this->m_rectPlot.top)) 
             {
                 RECT rc;
-                rc.bottom = this->m_rectPlot.top+1;
-                rc.left = prevX;
-                rc.right = currX+1;
-                rc.top = this->m_rectClient.top;
+                SetRect(&rc, prevX, this->m_rectClient.top, currX + 1, this->m_rectPlot.top + 1);
                 FillRect(this->m_dcPlot, &rc, this->m_brushBack);
             }
             if ((prevY >= this->m_rectPlot.bottom) || (currY >= this->m_rectPlot.bottom)) 
             {
                 RECT rc;
-                rc.bottom = this->m_rectClient.bottom+1;
-                rc.left = prevX;
-                rc.right = currX+1;
-                rc.top = this->m_rectPlot.bottom+1;
+                SetRect(&rc, prevX, this->m_rectPlot.bottom + 1, currX + 1,
+                        this->m_rectClient.bottom + 1);
                 /* RECT rc(prevX, m_rectPlot.bottom+1, currX+1, m_rectClient.bottom+1); */
                 FillRect(this->m_dcPlot, &rc, this->m_brushBack);
             }
diff --git a/programs/taskmgr/taskmgr.c b/programs/taskmgr/taskmgr.c
index 80dc81c..b280f79 100644
--- a/programs/taskmgr/taskmgr.c
+++ b/programs/taskmgr/taskmgr.c
@@ -65,10 +65,7 @@ static void FillSolidRect2(HDC hDC, int x, int y, int cx, int cy, COLORREF clr)
     RECT rect;
 
     SetBkColor(hDC, clr);
-    rect.left = x;
-    rect.top = y;
-    rect.right = x + cx;
-    rect.bottom = y + cy;
+    SetRect(&rect, x, y, x + cx, y + cy);
     ExtTextOutW(hDC, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
 }
 
diff --git a/programs/taskmgr/trayicon.c b/programs/taskmgr/trayicon.c
index 636d3bd..af98474 100644
--- a/programs/taskmgr/trayicon.c
+++ b/programs/taskmgr/trayicon.c
@@ -90,10 +90,7 @@ static HICON TrayIcon_GetProcessorUsageIcon(void)
      * just having 10.
      */
     nLinesToDraw = (ProcessorUsage + (ProcessorUsage / 10)) / 11;
-    rc.left = 3;
-    rc.top = 12 - nLinesToDraw;
-    rc.right = 13;
-    rc.bottom = 13;
+    SetRect(&rc, 3, 12 - nLinesToDraw, 13, 13);
 
     /*
      * Now draw the cpu usage




More information about the wine-cvs mailing list