From eea415300bedd747173a6cc0b41cffd57106e754 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 13 Apr 2005 16:13:45 +0000 Subject: [PATCH] Moved handling of the 55AA pattern brush to syscolor.c so that it can be made a system object (found by Rein Klazes). --- dlls/user/controls.h | 3 --- dlls/user/text.c | 3 ++- dlls/user/uitools.c | 27 ++------------------------- dlls/user/user_private.h | 1 + windows/defwnd.c | 2 +- windows/nonclient.c | 2 +- windows/syscolor.c | 11 ++++++++++- 7 files changed, 17 insertions(+), 32 deletions(-) diff --git a/dlls/user/controls.h b/dlls/user/controls.h index 5fd43dc1cab..a352d18a8ba 100644 --- a/dlls/user/controls.h +++ b/dlls/user/controls.h @@ -86,9 +86,6 @@ extern void SCROLL_TrackScrollBar( HWND hwnd, INT scrollbar, POINT pt ); extern INT SCROLL_SetNCSbState( HWND hwnd, int vMin, int vMax, int vPos, int hMin, int hMax, int hPos ); -/* UI tools */ -extern HBRUSH UITOOLS_GetPattern55AABrush(void); - /* combo box */ #define ID_CB_LISTBOX 1000 diff --git a/dlls/user/text.c b/dlls/user/text.c index fde309745cf..eb1c18e9b0b 100644 --- a/dlls/user/text.c +++ b/dlls/user/text.c @@ -39,6 +39,7 @@ #include "winerror.h" #include "winnls.h" #include "controls.h" +#include "user_private.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(text); @@ -1147,7 +1148,7 @@ static BOOL TEXT_GrayString(HDC hdc, HBRUSH hb, GRAYSTRINGPROC fn, LPARAM lp, IN if(retval || len != -1) #endif { - hbsave = (HBRUSH)SelectObject(memdc, UITOOLS_GetPattern55AABrush()); + hbsave = (HBRUSH)SelectObject(memdc, SYSCOLOR_55AABrush); PatBlt(memdc, 0, 0, cx, cy, 0x000A0329); SelectObject(memdc, hbsave); } diff --git a/dlls/user/uitools.c b/dlls/user/uitools.c index a92f033b9e3..316bf9163fd 100644 --- a/dlls/user/uitools.c +++ b/dlls/user/uitools.c @@ -32,15 +32,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(graphics); -static const WORD wPattern55AA[] = -{ - 0x5555, 0xaaaa, 0x5555, 0xaaaa, - 0x5555, 0xaaaa, 0x5555, 0xaaaa -}; - -static HBRUSH hPattern55AABrush; -static HBITMAP hPattern55AABitmap; - /* These tables are used in: * UITOOLS_DrawDiagEdge() * UITOOLS_DrawRectEdge() @@ -122,20 +113,6 @@ static const signed char LTRBInnerFlat[] = { #define COLOR_MAX COLOR_MENUBAR -/********************************************************************* - * UITOOLS_GetPattern55AABrush - */ -HBRUSH UITOOLS_GetPattern55AABrush(void) -{ - if (!hPattern55AABrush) - { - hPattern55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA ); - hPattern55AABrush = CreatePatternBrush( hPattern55AABitmap ); - } - return hPattern55AABrush; -} - - /*********************************************************************** * UITOOLS_DrawDiagEdge * @@ -647,7 +624,7 @@ static void UITOOLS_DrawCheckedRect( HDC dc, LPRECT rect ) FillRect(dc, rect, GetSysColorBrush(COLOR_BTNFACE)); bg = SetBkColor(dc, RGB(255, 255, 255)); - hbsave = SelectObject(dc, UITOOLS_GetPattern55AABrush()); + hbsave = SelectObject(dc, SYSCOLOR_55AABrush); PatBlt(dc, rect->left, rect->top, rect->right-rect->left, rect->bottom-rect->top, 0x00FA0089); SelectObject(dc, hbsave); SetBkColor(dc, bg); @@ -1858,7 +1835,7 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp /* This state cause the image to be dithered */ if(flags & DSS_UNION) { - hbsave = (HBRUSH)SelectObject(memdc, UITOOLS_GetPattern55AABrush()); + hbsave = (HBRUSH)SelectObject(memdc, SYSCOLOR_55AABrush); if(!hbsave) goto cleanup; tmp = PatBlt(memdc, 0, 0, cx, cy, 0x00FA0089); SelectObject(memdc, hbsave); diff --git a/dlls/user/user_private.h b/dlls/user/user_private.h index be562a9904e..4b85db80a95 100644 --- a/dlls/user/user_private.h +++ b/dlls/user/user_private.h @@ -121,6 +121,7 @@ extern USER_DRIVER USER_Driver; extern HMODULE user32_module; extern DWORD USER16_AlertableWait; +extern HBRUSH SYSCOLOR_55AABrush; extern BOOL CLIPBOARD_ReleaseOwner(void); extern BOOL FOCUS_MouseActivate( HWND hwnd ); diff --git a/windows/defwnd.c b/windows/defwnd.c index 2180598bb30..512d61facfc 100644 --- a/windows/defwnd.c +++ b/windows/defwnd.c @@ -166,7 +166,7 @@ HBRUSH DEFWND_ControlColor( HDC hDC, UINT ctlType ) * look different from the window background. */ if (bk == GetSysColor(COLOR_WINDOW)) - return UITOOLS_GetPattern55AABrush(); + return SYSCOLOR_55AABrush; UnrealizeObject( hb ); return hb; diff --git a/windows/nonclient.c b/windows/nonclient.c index 26f52796114..2ef3c02fa7e 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -259,7 +259,7 @@ BOOL WINAPI DrawCaptionTempW (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, FillRect (hdc, &rc, GetSysColorBrush (COLOR_3DFACE)); if (uFlags & DC_ACTIVE) { - HBRUSH hbr = SelectObject (hdc, UITOOLS_GetPattern55AABrush ()); + HBRUSH hbr = SelectObject (hdc, SYSCOLOR_55AABrush); PatBlt (hdc, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, 0xFA0089); SelectObject (hdc, hbr); diff --git a/windows/syscolor.c b/windows/syscolor.c index df98d5a3884..cf7cf389c89 100644 --- a/windows/syscolor.c +++ b/windows/syscolor.c @@ -80,6 +80,11 @@ static COLORREF SysColors[NUM_SYS_COLORS]; static HBRUSH SysColorBrushes[NUM_SYS_COLORS]; static HPEN SysColorPens[NUM_SYS_COLORS]; +static const WORD wPattern55AA[] = + { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa }; + +HBRUSH SYSCOLOR_55AABrush = 0; + /************************************************************************* * SYSCOLOR_MakeObjectSystem @@ -145,6 +150,7 @@ void SYSCOLOR_Init(void) char buffer[100]; BOOL bOk = FALSE, bNoReg = FALSE; HKEY hKey; + HBITMAP h55AABitmap; /* first, try to read the values from the registry */ if (RegCreateKeyExA(HKEY_CURRENT_USER, "Control Panel\\Colors", 0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) @@ -178,6 +184,10 @@ void SYSCOLOR_Init(void) } if (!bNoReg) RegCloseKey(hKey); + + h55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA ); + SYSCOLOR_55AABrush = CreatePatternBrush( h55AABitmap ); + SYSCOLOR_MakeObjectSystem( HBRUSH_16(SYSCOLOR_55AABrush), TRUE ); } @@ -316,5 +326,4 @@ HPEN SYSCOLOR_GetPen( INT index ) /* We can assert here, because this function is internal to Wine */ assert (0 <= index && index < NUM_SYS_COLORS); return SysColorPens[index]; - }