[uxtheme]

- Use double buffering when painting the caption

svn path=/branches/GSoC_2011/ThemesSupport/; revision=52544
This commit is contained in:
Giannis Adamopoulos 2011-07-05 10:15:09 +00:00
parent 47f499522a
commit 29e5fe2299

View file

@ -26,6 +26,10 @@ typedef struct _DRAW_CONTEXT
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 @@ typedef enum {
#define BUTTON_GAP_SIZE 2
#define MENU_BAR_ITEMS_SPACE (12)
HFONT hMenuFont = NULL;
HFONT hMenuFontBold = NULL;
@ -234,6 +239,29 @@ ThemeCleanupDrawContext(PDRAW_CONTEXT pcontext)
}
}
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,
@ -663,7 +691,9 @@ ThemePaintWindow(PDRAW_CONTEXT pcontext, RECT* prcCurrent)
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