- Move CreateFrameBrushes() and DeleteFrameBrushes() to file where they are

actually used
- Only call them when needed
- Fix resource specification so CreateFrameBrushes() can actually find the
  bitmap it needs

svn path=/trunk/; revision=5743
This commit is contained in:
Gé van Geldorp 2003-08-22 07:51:32 +00:00
parent c6066fbd1a
commit adaa3d6de2
6 changed files with 64 additions and 46 deletions

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.25 2003/08/15 10:51:51 rcampbell Exp $
# $Id: Makefile,v 1.26 2003/08/22 07:51:32 gvg Exp $
PATH_TO_TOP = ../..
@ -22,6 +22,8 @@ TARGET_CFLAGS += -D_DISABLE_TIDENTS
TARGET_LFLAGS = -nostartfiles -nostdlib
TARGET_RCFLAGS = --include-dir ./include
CONTROLS_OBJECTS = \
controls/combo.o \
controls/edit.o \

View file

@ -0,0 +1,8 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
* FILE: include/resource.h
* PURPOSE: Definition of resource ids
*/
#define DF_HATCH 30000

View file

@ -12,7 +12,6 @@ typedef struct _USER32_THREAD_DATA
MSG LastMessage;
} USER32_THREAD_DATA, *PUSER32_THREAD_DATA;
PUSER32_THREAD_DATA
User32GetThreadData();
extern HBRUSH FrameBrushes[13];
#define DF_HATCH (30000)
PUSER32_THREAD_DATA User32GetThreadData();
VOID DeleteFrameBrushes(VOID);

View file

@ -20,8 +20,6 @@ static ULONG User32TlsIndex;
VOID STDCALL KeBugCheck (ULONG BugCheckCode) {}
HWINSTA ProcessWindowStation;
HBRUSH FrameBrushes[13];
HBITMAP hHatch;
PUSER32_THREAD_DATA
User32GetThreadData()
@ -48,42 +46,6 @@ CleanupThread(VOID)
HeapFree(GetProcessHeap(), HEAP_ZERO_MEMORY, ThreadData);
TlsSetValue(User32TlsIndex, 0);
}
VOID
CreateFrameBrushes(HINSTANCE hInstance)
{
FrameBrushes[0] = CreateSolidBrush(RGB(0,0,0));
FrameBrushes[1] = CreateSolidBrush(RGB(0,0,128));
FrameBrushes[2] = CreateSolidBrush(RGB(10,36,106));
FrameBrushes[3] = CreateSolidBrush(RGB(128,128,128));
FrameBrushes[4] = CreateSolidBrush(RGB(181,181,181));
FrameBrushes[5] = CreateSolidBrush(RGB(212,208,200));
FrameBrushes[6] = CreateSolidBrush(RGB(236,233,216));
FrameBrushes[7] = CreateSolidBrush(RGB(255,255,255));
FrameBrushes[8] = CreateSolidBrush(RGB(49,106,197));
FrameBrushes[9] = CreateSolidBrush(RGB(58,110,165));
FrameBrushes[10] = CreateSolidBrush(RGB(64,64,64));
FrameBrushes[11] = CreateSolidBrush(RGB(255,255,225));
hHatch = LoadBitmapW(hInstance,MAKEINTRESOURCEW(DF_HATCH));
FrameBrushes[12] = CreatePatternBrush(hHatch);
}
VOID
DeleteFrameBrushes(VOID)
{
DeleteObject(FrameBrushes[0]);
DeleteObject(FrameBrushes[1]);
DeleteObject(FrameBrushes[2]);
DeleteObject(FrameBrushes[3]);
DeleteObject(FrameBrushes[4]);
DeleteObject(FrameBrushes[5]);
DeleteObject(FrameBrushes[6]);
DeleteObject(FrameBrushes[7]);
DeleteObject(FrameBrushes[8]);
DeleteObject(FrameBrushes[9]);
DeleteObject(FrameBrushes[10]);
DeleteObject(FrameBrushes[11]);
DeleteObject(FrameBrushes[12]);
DeleteObject(hHatch);
}
DWORD
Init(VOID)
@ -156,7 +118,6 @@ DllMain(
hProcessHeap = RtlGetProcessHeap();
Init();
InitThread();
CreateFrameBrushes(hinstDll);
break;
case DLL_THREAD_ATTACH:
InitThread();
@ -165,7 +126,7 @@ DllMain(
CleanupThread();
break;
case DLL_PROCESS_DETACH:
DeleteFrameBrushes();
DeleteFrameBrushes();
CleanupThread();
Cleanup();
break;

View file

@ -1,6 +1,7 @@
#include <defines.h>
#include <reactos/resource.h>
#include <messages.h>
#include <resource.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: paint.c,v 1.17 2003/08/18 09:59:29 silverblade Exp $
/* $Id: paint.c,v 1.18 2003/08/22 07:51:32 gvg Exp $
*
* PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/input.c
@ -29,12 +29,55 @@
/* INCLUDES ******************************************************************/
#include <windows.h>
#include <resource.h>
#include <user32.h>
#define NDEBUG
#include <debug.h>
static HBRUSH FrameBrushes[13];
static HBITMAP hHatch;
/* FUNCTIONS *****************************************************************/
static VOID
CreateFrameBrushes()
{
FrameBrushes[0] = CreateSolidBrush(RGB(0,0,0));
FrameBrushes[1] = CreateSolidBrush(RGB(0,0,128));
FrameBrushes[2] = CreateSolidBrush(RGB(10,36,106));
FrameBrushes[3] = CreateSolidBrush(RGB(128,128,128));
FrameBrushes[4] = CreateSolidBrush(RGB(181,181,181));
FrameBrushes[5] = CreateSolidBrush(RGB(212,208,200));
FrameBrushes[6] = CreateSolidBrush(RGB(236,233,216));
FrameBrushes[7] = CreateSolidBrush(RGB(255,255,255));
FrameBrushes[8] = CreateSolidBrush(RGB(49,106,197));
FrameBrushes[9] = CreateSolidBrush(RGB(58,110,165));
FrameBrushes[10] = CreateSolidBrush(RGB(64,64,64));
FrameBrushes[11] = CreateSolidBrush(RGB(255,255,225));
hHatch = LoadBitmapW(NULL,MAKEINTRESOURCEW(DF_HATCH));
FrameBrushes[12] = CreatePatternBrush(hHatch);
}
VOID
DeleteFrameBrushes(VOID)
{
unsigned Brush;
for (Brush = 0; Brush < sizeof(FrameBrushes) / sizeof(HBRUSH); Brush++)
{
if (NULL != FrameBrushes[Brush])
{
DeleteObject(FrameBrushes[Brush]);
FrameBrushes[Brush] = NULL;
}
}
if (NULL != hHatch)
{
DeleteObject(hHatch);
hHatch = NULL;
}
}
/*
* @implemented
*/
@ -252,6 +295,10 @@ DrawFrame(
DWORD brush;
HBRUSH hbrFrame;
PATRECT p[4];
if (NULL == FrameBrushes[0])
{
CreateFrameBrushes();
}
if (type & 4)
{
rop = PATINVERT;