Hi,
I suspect its an alignment issue, since GreCreateBitmap requires 32bit
alignment, while CreateBitmap uses 16 bit alignment.
So changing
+ static const WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555,
0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
to
+ static const DWORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555,
0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
Should do the trick.
Am 21.05.2011 08:34, schrieb jimtabor(a)svn.reactos.org:
Author: jimtabor
Date: Sat May 21 06:34:02 2011
New Revision: 51835
URL:
http://svn.reactos.org/svn/reactos?rev=51835&view=rev
Log:
[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.
Modified:
trunk/reactos/dll/win32/user32/windows/defwnd.c
trunk/reactos/subsystems/win32/win32k/include/brush.h
trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c
trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
trunk/reactos/subsystems/win32/win32k/objects/brush.c
Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1]
(original)
+++ trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] Sat
May 21 06:34:02 2011
@@ -927,8 +927,8 @@
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 @@
* 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);
}
Modified: trunk/reactos/subsystems/win32/win32k/include/brush.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/brush.h
[iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/brush.h
[iso-8859-1] Sat May 21 06:34:02 2011
@@ -129,3 +129,5 @@
VOID FASTCALL FreeObjectAttr(PVOID);
BOOL FASTCALL IntGdiSetBrushOwner(PBRUSH,DWORD);
+BOOL FASTCALL GreSetBrushOwner(HBRUSH,DWORD);
+
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c
[iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c
[iso-8859-1] Sat May 21 06:34:02 2011
@@ -92,6 +92,8 @@
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 @@
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;
}
Modified: trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
[iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/bitmaps.c
[iso-8859-1] Sat May 21 06:34:02 2011
@@ -154,15 +154,23 @@
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
Modified: trunk/reactos/subsystems/win32/win32k/objects/brush.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/brush.c
[iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/brush.c
[iso-8859-1] Sat May 21 06:34:02 2011
@@ -59,6 +59,19 @@
GDIOBJ_vSetObjectOwner(&pbr->BaseObject, 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
_______________________________________________
Ros-dev mailing list
Ros-dev(a)reactos.org