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

Signed-off-by: Michael Stefaniuc <mstefani@redhat.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2016-07-19 09:55:04 +02:00 committed by Alexandre Julliard
parent 3223e15230
commit 07ada9a85b
7 changed files with 12 additions and 47 deletions

View File

@ -690,11 +690,8 @@ static UINT BUTTON_CalcLabelRect(HWND hwnd, HDC hdc, RECT *rc)
static BOOL CALLBACK BUTTON_DrawTextCallback(HDC hdc, LPARAM lp, WPARAM wp, int cx, int cy) static BOOL CALLBACK BUTTON_DrawTextCallback(HDC hdc, LPARAM lp, WPARAM wp, int cx, int cy)
{ {
RECT rc; RECT rc;
rc.left = 0;
rc.top = 0;
rc.right = cx;
rc.bottom = cy;
SetRect(&rc, 0, 0, cx, cy);
DrawTextW(hdc, (LPCWSTR)lp, -1, &rc, (UINT)wp); DrawTextW(hdc, (LPCWSTR)lp, -1, &rc, (UINT)wp);
return TRUE; return TRUE;
} }

View File

@ -2289,10 +2289,7 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
if (DoOffscreen) { if (DoOffscreen) {
RECT r; RECT r;
r.left = 0; SetRect(&r, 0, 0, cxWidth, cxWidth);
r.top = 0;
r.right = cxWidth;
r.bottom = cxWidth;
if (!(hdc_dest = CreateCompatibleDC(hdc))) goto failed; if (!(hdc_dest = CreateCompatibleDC(hdc))) goto failed;
if (!(hB_off = CreateCompatibleBitmap(hdc, cxWidth, cyWidth))) if (!(hB_off = CreateCompatibleBitmap(hdc, cxWidth, cyWidth)))

View File

@ -517,9 +517,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
/* Create dialog main window */ /* Create dialog main window */
rect.left = rect.top = 0; SetRect(&rect, 0, 0, MulDiv(template.cx, xBaseUnit, 4), MulDiv(template.cy, yBaseUnit, 8));
rect.right = MulDiv(template.cx, xBaseUnit, 4);
rect.bottom = MulDiv(template.cy, yBaseUnit, 8);
if (template.style & DS_CONTROL) if (template.style & DS_CONTROL)
template.style &= ~(WS_CAPTION|WS_SYSMENU); template.style &= ~(WS_CAPTION|WS_SYSMENU);

View File

@ -1244,10 +1244,7 @@ LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM
{ {
RECT rect; RECT rect;
rect.left = 0; SetRect(&rect, 0, 0, LOWORD(lParam), HIWORD(lParam));
rect.top = 0;
rect.right = LOWORD(lParam);
rect.bottom = HIWORD(lParam);
AdjustWindowRectEx(&rect, GetWindowLongA(ci->hwndActiveChild, GWL_STYLE), AdjustWindowRectEx(&rect, GetWindowLongA(ci->hwndActiveChild, GWL_STYLE),
0, GetWindowLongA(ci->hwndActiveChild, GWL_EXSTYLE) ); 0, GetWindowLongA(ci->hwndActiveChild, GWL_EXSTYLE) );
MoveWindow(ci->hwndActiveChild, rect.left, rect.top, MoveWindow(ci->hwndActiveChild, rect.left, rect.top,

View File

@ -1343,10 +1343,7 @@ MENU_DrawScrollArrows(const POPUPMENU *lppop, HDC hdc)
hOrigBitmap = SelectObject(hdcMem, get_up_arrow_bitmap()); hOrigBitmap = SelectObject(hdcMem, get_up_arrow_bitmap());
else else
hOrigBitmap = SelectObject(hdcMem, get_up_arrow_inactive_bitmap()); hOrigBitmap = SelectObject(hdcMem, get_up_arrow_inactive_bitmap());
rect.left = 0; SetRect(&rect, 0, 0, lppop->Width, arrow_bitmap_height);
rect.top = 0;
rect.right = lppop->Width;
rect.bottom = arrow_bitmap_height;
FillRect(hdc, &rect, GetSysColorBrush(COLOR_MENU)); FillRect(hdc, &rect, GetSysColorBrush(COLOR_MENU));
BitBlt(hdc, (lppop->Width - arrow_bitmap_width) / 2, 0, BitBlt(hdc, (lppop->Width - arrow_bitmap_width) / 2, 0,
arrow_bitmap_width, arrow_bitmap_height, hdcMem, 0, 0, SRCCOPY); arrow_bitmap_width, arrow_bitmap_height, hdcMem, 0, 0, SRCCOPY);

View File

@ -796,10 +796,7 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
/* Define bounding box */ /* Define bounding box */
i = 14*SmallDiam/16; i = 14*SmallDiam/16;
myr.left = xc - i+i/2; SetRect(&myr, xc - i + i / 2, yc - i + i / 2, xc + i / 2, yc + i / 2);
myr.right = xc + i/2;
myr.top = yc - i+i/2;
myr.bottom = yc + i/2;
if((uFlags & 0xff) == DFCS_BUTTONRADIOMASK) if((uFlags & 0xff) == DFCS_BUTTONRADIOMASK)
{ {
@ -840,10 +837,7 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
} }
i = 10*SmallDiam/16; i = 10*SmallDiam/16;
myr.left = xc - i+i/2; SetRect(&myr, xc - i + i / 2, yc - i + i / 2, xc + i / 2, yc + i / 2);
myr.right = xc + i/2;
myr.top = yc - i+i/2;
myr.bottom = yc + i/2;
i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE; i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE;
hpsave = SelectObject(dc, SYSCOLOR_GetPen(i)); hpsave = SelectObject(dc, SYSCOLOR_GetPen(i));
hbsave = SelectObject(dc, GetSysColorBrush(i)); hbsave = SelectObject(dc, GetSysColorBrush(i));
@ -856,10 +850,7 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
{ {
i = 6*SmallDiam/16; i = 6*SmallDiam/16;
i = i < 1 ? 1 : i; i = i < 1 ? 1 : i;
myr.left = xc - i+i/2; SetRect(&myr, xc - i + i / 2, yc - i + i / 2, xc + i / 2, yc + i / 2);
myr.right = xc + i/2;
myr.top = yc - i+i/2;
myr.bottom = yc + i/2;
i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_WINDOWTEXT; i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_WINDOWTEXT;
hbsave = SelectObject(dc, GetSysColorBrush(i)); hbsave = SelectObject(dc, GetSysColorBrush(i));
@ -1189,10 +1180,7 @@ static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
yc = myr.top + SmallDiam - SmallDiam/2; yc = myr.top + SmallDiam - SmallDiam/2;
i = 234*SmallDiam/750; i = 234*SmallDiam/750;
i = i < 1 ? 1 : i; i = i < 1 ? 1 : i;
myr.left = xc - i+i/2; SetRect(&myr, xc - i + i / 2, yc - i + i / 2, xc + i / 2, yc + i / 2);
myr.right = xc + i/2;
myr.top = yc - i+i/2;
myr.bottom = yc + i/2;
Pie(dc, myr.left, myr.top, myr.right, myr.bottom, xe, ye, xe, ye); Pie(dc, myr.left, myr.top, myr.right, myr.bottom, xe, ye, xe, ye);
break; break;
@ -1648,10 +1636,7 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp
if(!cy) cy = s.cy; if(!cy) cy = s.cy;
} }
rc.left = x; SetRect(&rc, x, y, x + cx, y + cy);
rc.top = y;
rc.right = x + cx;
rc.bottom = y + cy;
if(flags & DSS_RIGHT) /* This one is not documented in the win32.hlp file */ if(flags & DSS_RIGHT) /* This one is not documented in the win32.hlp file */
dtflags |= DT_RIGHT; dtflags |= DT_RIGHT;
@ -1679,9 +1664,7 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp
if(!memdc) goto cleanup; if(!memdc) goto cleanup;
hbmsave = SelectObject(memdc, hbm); hbmsave = SelectObject(memdc, hbm);
if(!hbmsave) goto cleanup; if(!hbmsave) goto cleanup;
rc.left = rc.top = 0; SetRect(&rc, 0, 0, cx, cy);
rc.right = cx;
rc.bottom = cy;
if(!FillRect(memdc, &rc, GetStockObject(WHITE_BRUSH))) goto cleanup; if(!FillRect(memdc, &rc, GetStockObject(WHITE_BRUSH))) goto cleanup;
SetBkColor(memdc, RGB(255, 255, 255)); SetBkColor(memdc, RGB(255, 255, 255));
SetTextColor(memdc, RGB(0, 0, 0)); SetTextColor(memdc, RGB(0, 0, 0));

View File

@ -3567,11 +3567,7 @@ BOOL WINAPI DragDetect( HWND hWnd, POINT pt )
WORD wDragWidth = GetSystemMetrics(SM_CXDRAG); WORD wDragWidth = GetSystemMetrics(SM_CXDRAG);
WORD wDragHeight= GetSystemMetrics(SM_CYDRAG); WORD wDragHeight= GetSystemMetrics(SM_CYDRAG);
rect.left = pt.x - wDragWidth; SetRect(&rect, pt.x - wDragWidth, pt.y - wDragHeight, pt.x + wDragWidth, pt.y + wDragHeight);
rect.right = pt.x + wDragWidth;
rect.top = pt.y - wDragHeight;
rect.bottom = pt.y + wDragHeight;
SetCapture(hWnd); SetCapture(hWnd);