From: Giannis Adamopoulos Date: Mon, 20 Nov 2017 16:51:03 +0000 (+0200) Subject: [COMCTL32] Button: Use double buffering when themes are enabled. X-Git-Tag: v0.4.7~32 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=1bfbdb612305efa463d3fc5846e0c3b40dcc3a02 [COMCTL32] Button: Use double buffering when themes are enabled. --- diff --git a/dll/win32/comctl32/theme_button.c b/dll/win32/comctl32/theme_button.c index 755f4a7f060..4e72b0aa296 100644 --- a/dll/win32/comctl32/theme_button.c +++ b/dll/win32/comctl32/theme_button.c @@ -456,6 +456,36 @@ BOOL BUTTON_PaintWithTheme(HTHEME theme, HWND hwnd, HDC hParamDC, LPARAM prfFlag else drawState = STATE_NORMAL; + if (paint == PB_draw || paint == CB_draw) + { + HDC hdc; + HBITMAP hbmp; + RECT rc; + + GetClientRect(hwnd, &rc); + hdc = CreateCompatibleDC(hParamDC); + hbmp = CreateCompatibleBitmap(hParamDC, rc.right, rc.bottom); + if (hdc && hbmp) + { + SelectObject(hdc, hbmp); + + paint(theme, hwnd, hdc, drawState, dtFlags, state & BST_FOCUS, prfFlag); + + BitBlt(hParamDC, 0, 0, rc.right, rc.bottom, hdc, 0, 0, SRCCOPY); + DeleteObject(hbmp); + DeleteDC(hdc); + return TRUE; + } + else + { + ERR("Failed to create DC and bitmap for double buffering\n"); + if (hbmp) + DeleteObject(hbmp); + if (hdc) + DeleteDC(hdc); + } + } + paint(theme, hwnd, hParamDC, drawState, dtFlags, state & BST_FOCUS, prfFlag); return TRUE; }