user32: Delay creation of the 55AA pattern brush until it's needed.

This commit is contained in:
Alexandre Julliard 2013-10-16 16:07:53 +02:00
parent 7370a56543
commit 209d1a86d2
6 changed files with 29 additions and 15 deletions

View File

@ -167,7 +167,7 @@ HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType )
* look different from the window background. * look different from the window background.
*/ */
if (bk == GetSysColor(COLOR_WINDOW)) if (bk == GetSysColor(COLOR_WINDOW))
return SYSCOLOR_55AABrush; return SYSCOLOR_Get55AABrush();
UnrealizeObject( hb ); UnrealizeObject( hb );
return hb; return hb;

View File

@ -289,7 +289,7 @@ BOOL WINAPI DrawCaptionTempW (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont,
FillRect (hdc, &rc, GetSysColorBrush (COLOR_3DFACE)); FillRect (hdc, &rc, GetSysColorBrush (COLOR_3DFACE));
if (uFlags & DC_ACTIVE) { if (uFlags & DC_ACTIVE) {
HBRUSH hbr = SelectObject (hdc, SYSCOLOR_55AABrush); HBRUSH hbr = SelectObject (hdc, SYSCOLOR_Get55AABrush());
PatBlt (hdc, rc.left, rc.top, PatBlt (hdc, rc.left, rc.top,
rc.right-rc.left, rc.bottom-rc.top, 0xFA0089); rc.right-rc.left, rc.bottom-rc.top, 0xFA0089);
SelectObject (hdc, hbr); SelectObject (hdc, hbr);

View File

@ -242,12 +242,8 @@ static BOOL notify_change = TRUE;
/* System parameters storage */ /* System parameters storage */
static RECT work_area; static RECT work_area;
static const WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
static HKEY volatile_base_key; static HKEY volatile_base_key;
HBRUSH SYSCOLOR_55AABrush = 0;
union sysparam_all_entry; union sysparam_all_entry;
struct sysparam_entry struct sysparam_entry
@ -1346,11 +1342,6 @@ void SYSPARAMS_Init(void)
{ {
HKEY key; HKEY key;
DWORD i, dispos; DWORD i, dispos;
HBITMAP h55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA );
SYSCOLOR_55AABrush = CreatePatternBrush( h55AABitmap );
__wine_make_gdi_object_system( SYSCOLOR_55AABrush, TRUE );
DeleteObject( h55AABitmap );
/* this one must be non-volatile */ /* this one must be non-volatile */
if (RegCreateKeyW( HKEY_CURRENT_USER, WINE_CURRENT_USER_REGKEY, &key )) if (RegCreateKeyW( HKEY_CURRENT_USER, WINE_CURRENT_USER_REGKEY, &key ))
@ -2715,6 +2706,29 @@ HPEN SYSCOLOR_GetPen( INT index )
} }
/***********************************************************************
* SYSCOLOR_Get55AABrush
*/
HBRUSH SYSCOLOR_Get55AABrush(void)
{
static const WORD pattern[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
static HBRUSH brush_55aa;
if (!brush_55aa)
{
HBITMAP bitmap = CreateBitmap( 8, 8, 1, 1, pattern );
HBRUSH brush = CreatePatternBrush( bitmap );
DeleteObject( bitmap );
__wine_make_gdi_object_system( brush, TRUE );
if (InterlockedCompareExchangePointer( (void **)&brush_55aa, brush, 0 ))
{
__wine_make_gdi_object_system( brush, FALSE );
DeleteObject( brush );
}
}
return brush_55aa;
}
/*********************************************************************** /***********************************************************************
* ChangeDisplaySettingsA (USER32.@) * ChangeDisplaySettingsA (USER32.@)
*/ */

View File

@ -1240,7 +1240,7 @@ static BOOL TEXT_GrayString(HDC hdc, HBRUSH hb, GRAYSTRINGPROC fn, LPARAM lp, IN
if(retval || len != -1) if(retval || len != -1)
#endif #endif
{ {
hbsave = SelectObject(memdc, SYSCOLOR_55AABrush); hbsave = SelectObject(memdc, SYSCOLOR_Get55AABrush());
PatBlt(memdc, 0, 0, cx, cy, 0x000A0329); PatBlt(memdc, 0, 0, cx, cy, 0x000A0329);
SelectObject(memdc, hbsave); SelectObject(memdc, hbsave);
} }

View File

@ -649,7 +649,7 @@ static void UITOOLS_DrawCheckedRect( HDC dc, LPRECT rect )
FillRect(dc, rect, GetSysColorBrush(COLOR_BTNFACE)); FillRect(dc, rect, GetSysColorBrush(COLOR_BTNFACE));
bg = SetBkColor(dc, RGB(255, 255, 255)); bg = SetBkColor(dc, RGB(255, 255, 255));
hbsave = SelectObject(dc, SYSCOLOR_55AABrush); hbsave = SelectObject(dc, SYSCOLOR_Get55AABrush());
PatBlt(dc, rect->left, rect->top, rect->right-rect->left, rect->bottom-rect->top, 0x00FA0089); PatBlt(dc, rect->left, rect->top, rect->right-rect->left, rect->bottom-rect->top, 0x00FA0089);
SelectObject(dc, hbsave); SelectObject(dc, hbsave);
SetBkColor(dc, bg); SetBkColor(dc, bg);
@ -1703,7 +1703,7 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp
/* This state cause the image to be dithered */ /* This state cause the image to be dithered */
if(flags & DSS_UNION) if(flags & DSS_UNION)
{ {
hbsave = SelectObject(memdc, SYSCOLOR_55AABrush); hbsave = SelectObject(memdc, SYSCOLOR_Get55AABrush());
if(!hbsave) goto cleanup; if(!hbsave) goto cleanup;
tmp = PatBlt(memdc, 0, 0, cx, cy, 0x00FA0089); tmp = PatBlt(memdc, 0, 0, cx, cy, 0x00FA0089);
SelectObject(memdc, hbsave); SelectObject(memdc, hbsave);

View File

@ -209,7 +209,6 @@ static inline BOOL is_broadcast( HWND hwnd )
} }
extern HMODULE user32_module DECLSPEC_HIDDEN; extern HMODULE user32_module DECLSPEC_HIDDEN;
extern HBRUSH SYSCOLOR_55AABrush DECLSPEC_HIDDEN;
struct dce; struct dce;
struct tagWND; struct tagWND;
@ -234,6 +233,7 @@ extern LRESULT MSG_SendInternalMessageTimeout( DWORD dest_pid, DWORD dest_tid,
UINT msg, WPARAM wparam, LPARAM lparam, UINT msg, WPARAM wparam, LPARAM lparam,
UINT flags, UINT timeout, PDWORD_PTR res_ptr ) DECLSPEC_HIDDEN; UINT flags, UINT timeout, PDWORD_PTR res_ptr ) DECLSPEC_HIDDEN;
extern HPEN SYSCOLOR_GetPen( INT index ) DECLSPEC_HIDDEN; extern HPEN SYSCOLOR_GetPen( INT index ) DECLSPEC_HIDDEN;
extern HBRUSH SYSCOLOR_Get55AABrush(void) DECLSPEC_HIDDEN;
extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN; extern void SYSPARAMS_Init(void) DECLSPEC_HIDDEN;
extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN; extern void USER_CheckNotLock(void) DECLSPEC_HIDDEN;
extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN; extern BOOL USER_IsExitingThread( DWORD tid ) DECLSPEC_HIDDEN;