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@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/de... ============================================================================== --- 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/inc... ============================================================================== --- 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/ntu... ============================================================================== --- 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/obj... ============================================================================== --- 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/obj... ============================================================================== --- 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
I was thinking that should actually be:
+ static const DWORD wPattern55AA[] = { 0x55555555, 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA };
Note that you need 8 hex digits for 32-bit numbers.
On Sat, 21 May 2011 23:23:01 +1000, Timo Kreuzer timo.kreuzer@web.de wrote:
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@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/de... ============================================================================== --- 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/inc... ============================================================================== --- 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/ntu... ============================================================================== --- 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/obj... ============================================================================== --- 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/obj... ============================================================================== --- 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@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
We don't need that on LE architectures since the pixel size doesn't change and the upper 16 bits are simply padding. If we ever ported this to a BE architecture (maybe ppc?), we would in fact need that. Or use WORD and add padding words between the pixel words.
Am 21.05.2011 15:26, schrieb Adam:
I was thinking that should actually be:
- static const DWORD wPattern55AA[] = { 0x55555555, 0xAAAAAAAA,
0x55555555, 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA };
Note that you need 8 hex digits for 32-bit numbers.
On Sat, 21 May 2011 23:23:01 +1000, Timo Kreuzer timo.kreuzer@web.de wrote:
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@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/de... ==============================================================================
--- 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/inc... ==============================================================================
--- 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/ntu... ==============================================================================
--- 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/obj... ==============================================================================
--- 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/obj... ==============================================================================
--- 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@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
But still you'd want maximum portability right? And it isn't that much harm, IMO either.
On Sun, 22 May 2011 16:17:58 +1000, Timo Kreuzer timo.kreuzer@web.de wrote:
We don't need that on LE architectures since the pixel size doesn't change and the upper 16 bits are simply padding. If we ever ported this to a BE architecture (maybe ppc?), we would in fact need that. Or use WORD and add padding words between the pixel words.
Am 21.05.2011 15:26, schrieb Adam:
I was thinking that should actually be:
- static const DWORD wPattern55AA[] = { 0x55555555, 0xAAAAAAAA,
0x55555555, 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA };
Note that you need 8 hex digits for 32-bit numbers.
On Sat, 21 May 2011 23:23:01 +1000, Timo Kreuzer timo.kreuzer@web.de wrote:
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@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/de... ============================================================================== --- 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/inc... ============================================================================== --- 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/ntu... ============================================================================== --- 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/obj... ============================================================================== --- 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/obj... ============================================================================== --- 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@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
-----Original Message----- From: Adam Sent: Saturday, May 21, 2011 5:26 PM To: ros-dev@reactos.org ; Timo Kreuzer Subject: Re: [ros-dev] [ros-diffs] [jimtabor] 51835: [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 i...
I was thinking that should actually be:
+ static const DWORD wPattern55AA[] = { 0x55555555, 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA };
Note that you need 8 hex digits for 32-bit numbers.
Fantastic, so I suppose whenever I want my double word variable to have a value of, say, 0x54 taking your friendly reminder about 8 hex digits into account, I would need to write 0x54545454 because, you know, I need 8 hex digits for 32-bit numbers and need to add some random stuff to fill it up to 8 digits :)
WBR, Aleksey.
Eh... should have been a little clearer here.
I was thinking he wanted to set a bit pattern, and if you are setting a bit pattern like 0x55 or 0xAA then you'd need 8 hex digits for a 32-bit number. If you want "101010101..." or "0101010101..." for example.
In your example, sure a *value* wouldn't need the 8 digits, but if that was to be a bit pattern you could use 0x54545454 for example.
I was looking at his numbers thinking it was a pattern that needed to be filled up as 32-bit vectors instead of 16-bit ones.
On Sun, 22 May 2011 19:51:32 +1000, Aleksey Bragin aleksey@reactos.org wrote:
Fantastic, so I suppose whenever I want my double word variable to have a value of, say, 0x54 taking your friendly reminder about 8 hex digits into account, I would need to write 0x54545454 because, you know, I need 8 hex digits for 32-bit numbers and need to add some random stuff to fill it up to 8 digits :)
WBR, Aleksey. _______________________________________________ Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
You realise you're dealing with experienced programmers here? I'm fairly confident they've grasped the basic concepts of 32bit values and their use.
In the next installment, we'll be learning about the merits of using spaces instead of tabs. Stay tuned.
On 22 May 2011 11:05, Adam geekdundee@gmail.com wrote:
Eh... should have been a little clearer here.
I was thinking he wanted to set a bit pattern, and if you are setting a bit pattern like 0x55 or 0xAA then you'd need 8 hex digits for a 32-bit number. If you want "101010101..." or "0101010101..." for example.
In your example, sure a *value* wouldn't need the 8 digits, but if that was to be a bit pattern you could use 0x54545454 for example.
I was looking at his numbers thinking it was a pattern that needed to be filled up as 32-bit vectors instead of 16-bit ones.
On Sun, 22 May 2011 19:51:32 +1000, Aleksey Bragin aleksey@reactos.org wrote:
Fantastic, so I suppose whenever I want my double word variable to have a value of, say, 0x54 taking your friendly reminder about 8 hex digits into account, I would need to write 0x54545454 because, you know, I need 8 hex digits for 32-bit numbers and need to add some random stuff to fill it up to 8 digits :)
WBR, Aleksey. _______________________________________________ Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
-- Using Opera's revolutionary email client: http://www.opera.com/mail/
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
2011/5/22 Aleksey Bragin aleksey@reactos.org:
Fantastic, so I suppose whenever I want my double word variable to have a value of, say, 0x54 taking your friendly reminder about 8 hex digits into account, I would need to write 0x54545454 because, you know, I need 8 hex digits for 32-bit numbers and need to add some random stuff to fill it up to 8 digits :)
You can use something like this, though it's less self-descriptive:
#include <stdio.h> typedef unsigned int DWORD; #define DUP4BYTES(c) ((DWORD)(c) | (DWORD)(c) << 8 | (DWORD)(c) << 16 | (DWORD)(c) << 24)
int main() { unsigned int x = DUP4BYTES(0x54); printf("x = %08x\n", x);
return 0; }
GCC is smart enough to produce "movl $0x54545454,-0x4(%rbp)" in its output.