From b11b448d7209ce8bd1b639c5c1ecefc929759110 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Wed, 13 Jul 2016 09:52:13 +0200 Subject: [PATCH] taskmgr: Use SetRect() instead of open coding it. Signed-off-by: Michael Stefaniuc Signed-off-by: Alexandre Julliard --- 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 70051eb58c4..214cd75e7ba 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 80dc81ca629..b280f7975d3 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 636d3bda924..af98474c242 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