Moved handling of the 55AA pattern brush to syscolor.c so that it can

be made a system object (found by Rein Klazes).
This commit is contained in:
Alexandre Julliard 2005-04-13 16:13:45 +00:00
parent c2053e1ded
commit eea415300b
7 changed files with 17 additions and 32 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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);

View File

@ -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 );

View File

@ -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;

View File

@ -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);

View File

@ -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];
}