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

Signed-off-by: Michael Stefaniuc <mstefani@redhat.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Michael Stefaniuc 2016-04-29 15:58:29 +02:00 committed by Alexandre Julliard
parent 22bfbfe9fc
commit 903ea19122
10 changed files with 28 additions and 90 deletions

View File

@ -312,10 +312,7 @@ static BOOL ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC)
HBITMAP hbmOld2 = SelectObject(hdcFinal, hbmFinal);
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = nWidth;
rect.bottom = nHeight;
SetRect(&rect, 0, 0, nWidth, nHeight);
if(!infoPtr->hbrushBG)
infoPtr->hbrushBG = GetCurrentObject(hDC, OBJ_BRUSH);

View File

@ -1311,7 +1311,7 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *di
RECT exrc, cbrc, edrc;
GetWindowRect (infoPtr->hwndSelf, &exrc);
GetWindowRect (infoPtr->hwndCombo, &cbrc);
edrc.left = edrc.top = edrc.right = edrc.bottom = -1;
SetRect(&edrc, -1, -1, -1, -1);
if (infoPtr->hwndEdit) GetWindowRect (infoPtr->hwndEdit, &edrc);
TRACE("window rects ex=(%s), cb=(%s), ed=(%s)\n",
wine_dbgstr_rect(&exrc), wine_dbgstr_rect(&cbrc),
@ -1466,10 +1466,7 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *di
x = xbase + xioff;
y = dis->rcItem.top +
(dis->rcItem.bottom - dis->rcItem.top - txtsize.cy) / 2;
rect.left = x;
rect.right = x + txtsize.cx;
rect.top = dis->rcItem.top + 1;
rect.bottom = dis->rcItem.bottom - 1;
SetRect(&rect, x, dis->rcItem.top + 1, x + txtsize.cx, dis->rcItem.bottom - 1);
TRACE("drawing item %d text, rect=(%s)\n",
dis->itemID, wine_dbgstr_rect(&rect));
ExtTextOutW (dis->hDC, x, y, ETO_OPAQUE | ETO_CLIPPED,

View File

@ -783,10 +783,7 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size);
}
selection.left = 0;
selection.top = 0;
selection.right = size.cx;
selection.bottom = size.cy;
SetRect(&selection, 0, 0, size.cx, size.cy);
/* center rectangle */
OffsetRect(&selection, (field->right + field->left - size.cx)/2,
(field->bottom - size.cy)/2);

View File

@ -5445,9 +5445,7 @@ static HIMAGELIST LISTVIEW_CreateDragImage(LISTVIEW_INFO *infoPtr, INT iItem, LP
hOldbmp = SelectObject(hdc, hbmp);
hOldFont = SelectObject(hdc, infoPtr->hFont);
rcItem.left = rcItem.top = 0;
rcItem.right = size.cx;
rcItem.bottom = size.cy;
SetRect(&rcItem, 0, 0, size.cx, size.cy);
FillRect(hdc, &rcItem, infoPtr->hBkBrush);
pos.x = pos.y = 0;
@ -5756,10 +5754,9 @@ static void LISTVIEW_ScrollOnInsert(LISTVIEW_INFO *infoPtr, INT nItem, INT dir)
if (infoPtr->uView == LV_VIEW_DETAILS) return;
/* now for LISTs, we have to deal with the columns to the right */
rcScroll.left = (nItemCol + 1) * infoPtr->nItemWidth;
rcScroll.top = 0;
rcScroll.right = (infoPtr->nItemCount / nPerCol + 1) * infoPtr->nItemWidth;
rcScroll.bottom = nPerCol * infoPtr->nItemHeight;
SetRect(&rcScroll, (nItemCol + 1) * infoPtr->nItemWidth, 0,
(infoPtr->nItemCount / nPerCol + 1) * infoPtr->nItemWidth,
nPerCol * infoPtr->nItemHeight);
OffsetRect(&rcScroll, Origin.x, Origin.y);
if (IntersectRect(&rcScroll, &rcScroll, &infoPtr->rcList))
InvalidateRect(infoPtr->hwndSelf, &rcScroll, TRUE);
@ -8484,10 +8481,7 @@ static HIMAGELIST LISTVIEW_CreateCheckBoxIL(const LISTVIEW_INFO *infoPtr)
hbm_mask = CreateBitmap(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 1, 1, NULL);
ReleaseDC(infoPtr->hwndSelf, hdc_wnd);
rc.left = rc.top = 0;
rc.right = GetSystemMetrics(SM_CXSMICON);
rc.bottom = GetSystemMetrics(SM_CYSMICON);
SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
hbm_orig = SelectObject(hdc, hbm_mask);
FillRect(hdc, &rc, hbr_white);
InflateRect(&rc, -2, -2);
@ -8847,10 +8841,8 @@ static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFl
if (infoPtr->uView == LV_VIEW_DETAILS)
{
rcErase.left = 0;
rcErase.top = nFrom * infoPtr->nItemHeight;
rcErase.right = infoPtr->nItemWidth;
rcErase.bottom = nTo * infoPtr->nItemHeight;
SetRect(&rcErase, 0, nFrom * infoPtr->nItemHeight, infoPtr->nItemWidth,
nTo * infoPtr->nItemHeight);
OffsetRect(&rcErase, Origin.x, Origin.y);
if (IntersectRect(&rcErase, &rcErase, &infoPtr->rcList))
LISTVIEW_InvalidateRect(infoPtr, &rcErase);

View File

@ -163,10 +163,7 @@ typedef void (*ProgressDrawProc)(const ProgressDrawInfo* di, int start, int end)
static void draw_solid_bar_H (const ProgressDrawInfo* di, int start, int end)
{
RECT r;
r.left = di->rect.left + start;
r.top = di->rect.top;
r.right = di->rect.left + end;
r.bottom = di->rect.bottom;
SetRect(&r, di->rect.left + start, di->rect.top, di->rect.left + end, di->rect.bottom);
FillRect (di->hdc, &r, di->hbrBar);
}
@ -174,10 +171,7 @@ static void draw_solid_bar_H (const ProgressDrawInfo* di, int start, int end)
static void draw_solid_bkg_H (const ProgressDrawInfo* di, int start, int end)
{
RECT r;
r.left = di->rect.left + start;
r.top = di->rect.top;
r.right = di->rect.left + end;
r.bottom = di->rect.bottom;
SetRect(&r, di->rect.left + start, di->rect.top, di->rect.left + end, di->rect.bottom);
FillRect (di->hdc, &r, di->hbrBk);
}
@ -185,10 +179,7 @@ static void draw_solid_bkg_H (const ProgressDrawInfo* di, int start, int end)
static void draw_solid_bar_V (const ProgressDrawInfo* di, int start, int end)
{
RECT r;
r.left = di->rect.left;
r.top = di->rect.bottom - end;
r.right = di->rect.right;
r.bottom = di->rect.bottom - start;
SetRect(&r, di->rect.left, di->rect.bottom - end, di->rect.right, di->rect.bottom - start);
FillRect (di->hdc, &r, di->hbrBar);
}
@ -196,10 +187,7 @@ static void draw_solid_bar_V (const ProgressDrawInfo* di, int start, int end)
static void draw_solid_bkg_V (const ProgressDrawInfo* di, int start, int end)
{
RECT r;
r.left = di->rect.left;
r.top = di->rect.bottom - end;
r.right = di->rect.right;
r.bottom = di->rect.bottom - start;
SetRect(&r, di->rect.left, di->rect.bottom - end, di->rect.right, di->rect.bottom - start);
FillRect (di->hdc, &r, di->hbrBk);
}
@ -282,11 +270,7 @@ static void draw_theme_bkg_H (const ProgressDrawInfo* di, int start, int end)
{
RECT bgrect, r;
r.left = di->rect.left + start;
r.top = di->rect.top;
r.right = di->rect.left + end;
r.bottom = di->rect.bottom;
SetRect(&r, di->rect.left + start, di->rect.top, di->rect.left + end, di->rect.bottom);
bgrect = di->bgRect;
OffsetRect(&bgrect, -bgrect.left, -bgrect.top);
@ -298,11 +282,7 @@ static void draw_theme_bkg_V (const ProgressDrawInfo* di, int start, int end)
{
RECT bgrect, r;
r.left = di->rect.left;
r.top = di->rect.bottom - end;
r.right = di->rect.right;
r.bottom = di->rect.bottom - start;
SetRect(&r, di->rect.left, di->rect.bottom - end, di->rect.right, di->rect.bottom - start);
bgrect = di->bgRect;
OffsetRect(&bgrect, -bgrect.left, -bgrect.top);

View File

@ -709,11 +709,7 @@ static BOOL PROPSHEET_SizeMismatch(HWND hwndDlg, const PropSheetInfo* psInfo)
/*
* Biggest page size.
*/
rcPage.left = 0;
rcPage.top = 0;
rcPage.right = psInfo->width;
rcPage.bottom = psInfo->height;
SetRect(&rcPage, 0, 0, psInfo->width, psInfo->height);
MapDialogRect(hwndDlg, &rcPage);
TRACE("biggest page %s\n", wine_dbgstr_rect(&rcPage));
@ -747,11 +743,7 @@ static BOOL PROPSHEET_AdjustSize(HWND hwndDlg, PropSheetInfo* psInfo)
/*
* Biggest page size.
*/
rc.left = 0;
rc.top = 0;
rc.right = psInfo->width;
rc.bottom = psInfo->height;
SetRect(&rc, 0, 0, psInfo->width, psInfo->height);
MapDialogRect(hwndDlg, &rc);
/* retrieve the dialog units */
@ -822,10 +814,7 @@ static BOOL PROPSHEET_AdjustSizeWizard(HWND hwndDlg, const PropSheetInfo* psInfo
RECT rc, lineRect, dialogRect;
/* Biggest page size */
rc.left = 0;
rc.top = 0;
rc.right = psInfo->width;
rc.bottom = psInfo->height;
SetRect(&rc, 0, 0, psInfo->width, psInfo->height);
MapDialogRect(hwndDlg, &rc);
TRACE("Biggest page %s\n", wine_dbgstr_rect(&rc));
@ -3319,11 +3308,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam)
GetClientRect(hwndLine, &r);
MapWindowPoints(hwndLine, hwnd, (LPPOINT) &r, 2);
rzone.left = 0;
rzone.top = 0;
rzone.right = r.right;
rzone.bottom = r.top - 1;
SetRect(&rzone, 0, 0, r.right, r.top - 1);
hbr = GetSysColorBrush(COLOR_WINDOW);
FillRect(hdc, &rzone, hbr);

View File

@ -776,10 +776,7 @@ static VOID SYSLINK_Render (const SYSLINK_INFO *infoPtr, HDC hdc, PRECT pRect)
cbl->nChars = LineLen;
cbl->nSkip = SkipChars;
cbl->rc.left = x;
cbl->rc.top = y;
cbl->rc.right = x + szDim.cx;
cbl->rc.bottom = y + szDim.cy;
SetRect(&cbl->rc, x, y, x + szDim.cx, y + szDim.cy);
if (cbl->rc.right > szDoc.cx)
szDoc.cx = cbl->rc.right;

View File

@ -1769,8 +1769,7 @@ TAB_DrawItemInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect
rcImage = *drawRect;
rcTemp = *drawRect;
rcText.left = rcText.top = rcText.right = rcText.bottom = 0;
SetRectEmpty(&rcText);
/* get the rectangle that the text fits in */
if (item->pszText)

View File

@ -1231,9 +1231,7 @@ TOOLBAR_MeasureString(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *btnPtr,
GetTextExtentPoint32W (hdc, lpText, strlenW (lpText), lpSize);
/* feed above size into the rectangle for DrawText */
myrect.left = myrect.top = 0;
myrect.right = lpSize->cx;
myrect.bottom = lpSize->cy;
SetRect(&myrect, 0, 0, lpSize->cx, lpSize->cy);
/* Use DrawText to get true size as drawn (less pesky "&") */
DrawTextW (hdc, lpText, -1, &myrect, DT_VCENTER | DT_SINGLELINE |

View File

@ -497,16 +497,12 @@ TRACKBAR_DrawOneTic (const TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int fla
if (flags & TBS_VERT) {
offsetthumb = (infoPtr->rcThumb.bottom - infoPtr->rcThumb.top)/2;
rcTics.left = infoPtr->rcThumb.left - 2;
rcTics.right = infoPtr->rcThumb.right + 2;
rcTics.top = infoPtr->rcChannel.top + offsetthumb;
rcTics.bottom = infoPtr->rcChannel.bottom - offsetthumb - 1;
SetRect(&rcTics, infoPtr->rcThumb.left - 2, infoPtr->rcChannel.top + offsetthumb,
infoPtr->rcThumb.right + 2, infoPtr->rcChannel.bottom - offsetthumb - 1);
} else {
offsetthumb = (infoPtr->rcThumb.right - infoPtr->rcThumb.left)/2;
rcTics.left = infoPtr->rcChannel.left + offsetthumb;
rcTics.right = infoPtr->rcChannel.right - offsetthumb - 1;
rcTics.top = infoPtr->rcThumb.top - 2;
rcTics.bottom = infoPtr->rcThumb.bottom + 2;
SetRect(&rcTics, infoPtr->rcChannel.left + offsetthumb, infoPtr->rcThumb.top - 2,
infoPtr->rcChannel.right - offsetthumb - 1, infoPtr->rcThumb.bottom + 2);
}
if (flags & (TBS_TOP | TBS_LEFT)) {