Use clipping regions to reduce the amount of processing performed when the

toolbar is repainting.  Reduces processing by approximately 85-95% in most
cases.
This commit is contained in:
Chris Morgan 2000-05-25 23:01:20 +00:00 committed by Alexandre Julliard
parent bfd5b31a0e
commit b70b26709f

View file

@ -299,16 +299,20 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
static void static void
TOOLBAR_Refresh (HWND hwnd, HDC hdc) TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
TBUTTON_INFO *btnPtr; TBUTTON_INFO *btnPtr;
INT i; INT i;
RECT rcTemp;
/* draw buttons */ /* redraw necessary buttons */
btnPtr = infoPtr->buttons; btnPtr = infoPtr->buttons;
for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++)
TOOLBAR_DrawButton (hwnd, btnPtr, hdc); {
if(IntersectRect(&rcTemp, &(ps->rcPaint), &(btnPtr->rect)))
TOOLBAR_DrawButton (hwnd, btnPtr, hdc);
}
} }
@ -3456,14 +3460,18 @@ TOOLBAR_Notify (HWND hwnd, WPARAM wParam, LPARAM lParam)
static LRESULT static LRESULT
TOOLBAR_Paint (HWND hwnd, WPARAM wParam) TOOLBAR_Paint (HWND hwnd, WPARAM wParam)
{ {
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd);
HDC hdc; HDC hdc;
PAINTSTRUCT ps; PAINTSTRUCT ps;
/* fill ps.rcPaint with a default rect */
memcpy(&(ps.rcPaint), &(infoPtr->rcBound), sizeof(infoPtr->rcBound));
TOOLBAR_CalcToolbar( hwnd ); TOOLBAR_CalcToolbar( hwnd );
hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam; hdc = wParam==0 ? BeginPaint(hwnd, &ps) : (HDC)wParam;
TOOLBAR_Refresh (hwnd, hdc); TOOLBAR_Refresh (hwnd, hdc, &ps);
if (!wParam) if (!wParam) EndPaint (hwnd, &ps);
EndPaint (hwnd, &ps);
return 0; return 0;
} }