Author: gadamopoulos Date: Tue Jul 5 10:15:09 2011 New Revision: 52544
URL: http://svn.reactos.org/svn/reactos?rev=52544&view=rev Log: [uxtheme] - Use double buffering when painting the caption
Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c
Modified: branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2011/ThemesSupport/dll/win3... ============================================================================== --- branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c [iso-8859-1] (original) +++ branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c [iso-8859-1] Tue Jul 5 10:15:09 2011 @@ -26,6 +26,10 @@ BOOL Active; /* wi.dwWindowStatus isn't correct for mdi child windows */ HRGN hRgn; int CaptionHeight; + + /* for double buffering */ + HDC hDCScreen; + HBITMAP hbmpOld; } DRAW_CONTEXT, *PDRAW_CONTEXT;
typedef enum @@ -59,6 +63,7 @@
#define BUTTON_GAP_SIZE 2
+#define MENU_BAR_ITEMS_SPACE (12)
HFONT hMenuFont = NULL; HFONT hMenuFontBold = NULL; @@ -235,6 +240,29 @@ }
static void +ThemeStartBufferedPaint(PDRAW_CONTEXT pcontext, int cx, int cy) +{ + HBITMAP hbmp; + + pcontext->hDCScreen = pcontext->hDC; + pcontext->hDC = CreateCompatibleDC(pcontext->hDCScreen); + hbmp = CreateCompatibleBitmap(pcontext->hDCScreen, cx, cy); + pcontext->hbmpOld = (HBITMAP)SelectObject(pcontext->hDC, hbmp); +} + +static void +ThemeEndBufferedPaint(PDRAW_CONTEXT pcontext, int x, int y, int cx, int cy) +{ + HBITMAP hbmp; + BitBlt(pcontext->hDCScreen, 0, 0, cx, cy, pcontext->hDC, x, y, SRCCOPY); + hbmp = (HBITMAP) SelectObject(pcontext->hDC, pcontext->hbmpOld); + DeleteObject(pcontext->hDC); + DeleteObject(hbmp); + + pcontext->hDC = pcontext->hDCScreen; +} + +static void ThemeDrawCaptionButton(PDRAW_CONTEXT pcontext, RECT* prcCurrent, CAPTIONBUTTON buttonId, @@ -663,7 +691,9 @@
if((pcontext->wi.dwStyle & WS_CAPTION)==WS_CAPTION) { + ThemeStartBufferedPaint(pcontext, prcCurrent->right, pcontext->CaptionHeight); ThemeDrawCaption(pcontext, prcCurrent); + ThemeEndBufferedPaint(pcontext, 0, 0, prcCurrent->right, pcontext->CaptionHeight); ThemeDrawBorders(pcontext, prcCurrent); } else