[Win32k|User32]

- Move creation of the scrollbar Gray brush from user32 to win32k.
- Noticed a color and pattern (patchy white pattern) difference when using GreCreateBitmap and it did not work the same as the main function. Correcting this fixed the Gray brush. Someone from YAROTOWS needs to look into this.

svn path=/trunk/; revision=51835
This commit is contained in:
James Tabor 2011-05-21 06:34:02 +00:00
parent 2c6c1ba289
commit 67b57d645d
5 changed files with 48 additions and 28 deletions

View file

@ -927,7 +927,7 @@ DefWndHandleWindowPosChanged(HWND hWnd, WINDOWPOS* Pos)
HBRUSH HBRUSH
DefWndControlColor(HDC hDC, UINT ctlType) DefWndControlColor(HDC hDC, UINT ctlType)
{ {
if (CTLCOLOR_SCROLLBAR == ctlType) if (ctlType == CTLCOLOR_SCROLLBAR)
{ {
HBRUSH hb = GetSysColorBrush(COLOR_SCROLLBAR); HBRUSH hb = GetSysColorBrush(COLOR_SCROLLBAR);
COLORREF bk = GetSysColor(COLOR_3DHILIGHT); COLORREF bk = GetSysColor(COLOR_3DHILIGHT);
@ -938,29 +938,16 @@ DefWndControlColor(HDC hDC, UINT ctlType)
* we better use 0x55aa bitmap brush to make scrollbar's background * we better use 0x55aa bitmap brush to make scrollbar's background
* look different from the window background. * look different from the window background.
*/ */
if (bk == GetSysColor(COLOR_WINDOW)) if ( bk == GetSysColor(COLOR_WINDOW))
{ return gpsi->hbrGray;
static const WORD wPattern55AA[] =
{ UnrealizeObject( hb );
0x5555, 0xaaaa, 0x5555, 0xaaaa,
0x5555, 0xaaaa, 0x5555, 0xaaaa
};
static HBITMAP hPattern55AABitmap = NULL;
static HBRUSH hPattern55AABrush = NULL;
if (hPattern55AABrush == NULL)
{
hPattern55AABitmap = CreateBitmap(8, 8, 1, 1, wPattern55AA);
hPattern55AABrush = CreatePatternBrush(hPattern55AABitmap);
}
return hPattern55AABrush;
}
UnrealizeObject(hb);
return hb; return hb;
} }
SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT)); SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
if ((CTLCOLOR_EDIT == ctlType) || (CTLCOLOR_LISTBOX == ctlType)) if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX))
{ {
SetBkColor(hDC, GetSysColor(COLOR_WINDOW)); SetBkColor(hDC, GetSysColor(COLOR_WINDOW));
} }

View file

@ -129,3 +129,5 @@ PVOID FASTCALL AllocateObjectAttr(VOID);
VOID FASTCALL FreeObjectAttr(PVOID); VOID FASTCALL FreeObjectAttr(PVOID);
BOOL FASTCALL IntGdiSetBrushOwner(PBRUSH,DWORD); BOOL FASTCALL IntGdiSetBrushOwner(PBRUSH,DWORD);
BOOL FASTCALL GreSetBrushOwner(HBRUSH,DWORD);

View file

@ -92,6 +92,8 @@ UserInitialize(
HANDLE hPowerRequestEvent, HANDLE hPowerRequestEvent,
HANDLE hMediaRequestEvent) HANDLE hMediaRequestEvent)
{ {
static const WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
HBITMAP hPattern55AABitmap = NULL;
NTSTATUS Status; NTSTATUS Status;
// Set W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED | W32PF_IOWINSTA) // Set W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED | W32PF_IOWINSTA)
@ -125,6 +127,14 @@ UserInitialize(
CsrInit(); CsrInit();
if (gpsi->hbrGray == NULL)
{
hPattern55AABitmap = GreCreateBitmap(8, 8, 1, 1, (LPBYTE)wPattern55AA);
gpsi->hbrGray = IntGdiCreatePatternBrush(hPattern55AABitmap);
GreDeleteObject(hPattern55AABitmap);
GreSetBrushOwner(gpsi->hbrGray, GDI_OBJ_HMGR_PUBLIC);
}
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }

View file

@ -154,15 +154,23 @@ GreCreateBitmap(
IN UINT cBitsPixel, IN UINT cBitsPixel,
IN OPTIONAL PVOID pvBits) IN OPTIONAL PVOID pvBits)
{ {
HBITMAP hbmp;
/* Call the extended function */ /* Call the extended function */
return GreCreateBitmapEx(nWidth, hbmp = GreCreateBitmapEx(nWidth,
nHeight, nHeight,
0, /* auto width */ 0, /* auto width */
BitmapFormat(cBitsPixel * cPlanes, BI_RGB), BitmapFormat(cBitsPixel * cPlanes, BI_RGB),
0, /* no bitmap flags */ 0, /* no bitmap flags */
0, /* auto size */ 0, /* auto size */
pvBits, NULL,
DDB_SURFACE /* DDB */); DDB_SURFACE /* DDB */);
if (pvBits && hbmp)
{
PSURFACE psurf = SURFACE_ShareLockSurface(hbmp);
UnsafeSetBitmapBits(psurf, 0, pvBits);
SURFACE_ShareUnlockSurface(psurf);
}
return hbmp;
} }
HBITMAP HBITMAP

View file

@ -61,6 +61,19 @@ IntGdiSetBrushOwner(PBRUSH pbr, ULONG ulOwner)
return TRUE; return TRUE;
} }
BOOL
FASTCALL
GreSetBrushOwner(HBRUSH hBrush, ULONG ulOwner)
{
BOOL Ret;
PBRUSH pbrush;
pbrush = BRUSH_ShareLockBrush(hBrush);
Ret = IntGdiSetBrushOwner(pbrush, ulOwner);
BRUSH_ShareUnlockBrush(pbrush);
return Ret;
}
BOOL BOOL
NTAPI NTAPI
BRUSH_bAllocBrushAttr(PBRUSH pbr) BRUSH_bAllocBrushAttr(PBRUSH pbr)