[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,8 +927,8 @@ DefWndHandleWindowPosChanged(HWND hWnd, WINDOWPOS* Pos)
HBRUSH
DefWndControlColor(HDC hDC, UINT ctlType)
{
if (CTLCOLOR_SCROLLBAR == ctlType)
{
if (ctlType == CTLCOLOR_SCROLLBAR)
{
HBRUSH hb = GetSysColorBrush(COLOR_SCROLLBAR);
COLORREF bk = GetSysColor(COLOR_3DHILIGHT);
SetTextColor(hDC, GetSysColor(COLOR_3DFACE));
@ -938,37 +938,24 @@ DefWndControlColor(HDC hDC, UINT ctlType)
* we better use 0x55aa bitmap brush to make scrollbar's background
* look different from the window background.
*/
if (bk == GetSysColor(COLOR_WINDOW))
{
static const WORD wPattern55AA[] =
{
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);
if ( bk == GetSysColor(COLOR_WINDOW))
return gpsi->hbrGray;
UnrealizeObject( hb );
return hb;
}
}
SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
if ((CTLCOLOR_EDIT == ctlType) || (CTLCOLOR_LISTBOX == ctlType))
{
if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX))
{
SetBkColor(hDC, GetSysColor(COLOR_WINDOW));
}
}
else
{
{
SetBkColor(hDC, GetSysColor(COLOR_3DFACE));
return GetSysColorBrush(COLOR_3DFACE);
}
}
return GetSysColorBrush(COLOR_WINDOW);
}

View file

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

View file

@ -92,6 +92,8 @@ UserInitialize(
HANDLE hPowerRequestEvent,
HANDLE hMediaRequestEvent)
{
static const WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
HBITMAP hPattern55AABitmap = NULL;
NTSTATUS Status;
// Set W32PF_Flags |= (W32PF_READSCREENACCESSGRANTED | W32PF_IOWINSTA)
@ -125,6 +127,14 @@ UserInitialize(
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;
}

View file

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

View file

@ -61,6 +61,19 @@ IntGdiSetBrushOwner(PBRUSH pbr, ULONG ulOwner)
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
NTAPI
BRUSH_bAllocBrushAttr(PBRUSH pbr)