Commit a4812703 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move 55aa brush implementation from user32.

And don't expose __wine_make_gdi_object_system. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 2aba4c58
......@@ -523,22 +523,7 @@ HPEN SYSCOLOR_GetPen( INT index )
*/
HBRUSH SYSCOLOR_Get55AABrush(void)
{
static const WORD pattern[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
static HBRUSH brush_55aa;
if (!brush_55aa)
{
HBITMAP bitmap = CreateBitmap( 8, 8, 1, 1, pattern );
HBRUSH brush = CreatePatternBrush( bitmap );
DeleteObject( bitmap );
__wine_make_gdi_object_system( brush, TRUE );
if (InterlockedCompareExchangePointer( (void **)&brush_55aa, brush, 0 ))
{
__wine_make_gdi_object_system( brush, FALSE );
DeleteObject( brush );
}
}
return brush_55aa;
return UlongToHandle( NtUserCallOneParam( COLOR_55AA_BRUSH, NtUserGetSysColorBrush ));
}
/***********************************************************************
......
......@@ -452,15 +452,7 @@ static const struct DefaultFontInfo default_fonts[] =
},
};
/*************************************************************************
* __wine_make_gdi_object_system (win32u.@)
*
* USER has to tell GDI that its system brushes and pens are non-deletable.
* For a description of the GDI object magics and their flags,
* see "Undocumented Windows" (wrong about the OBJECT_NOSYSTEM flag, though).
*/
void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set)
void make_gdi_object_system( HGDIOBJ handle, BOOL set)
{
GDI_HANDLE_ENTRY *entry;
......@@ -1191,7 +1183,6 @@ static struct unix_funcs unix_funcs =
__wine_get_icm_profile,
__wine_get_vulkan_driver,
__wine_get_wgl_driver,
__wine_make_gdi_object_system,
__wine_set_display_driver,
__wine_set_visible_region,
};
......
......@@ -374,6 +374,7 @@ extern HGDIOBJ GDI_inc_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
extern BOOL GDI_dec_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
extern HGDIOBJ get_stock_object( INT obj ) DECLSPEC_HIDDEN;
extern DWORD get_gdi_object_type( HGDIOBJ obj ) DECLSPEC_HIDDEN;
extern void make_gdi_object_system( HGDIOBJ handle, BOOL set ) DECLSPEC_HIDDEN;
/* mapping.c */
extern BOOL dp_to_lp( DC *dc, POINT *points, INT count ) DECLSPEC_HIDDEN;
......
......@@ -2357,12 +2357,12 @@ static BOOL set_rgb_entry( union sysparam_all_entry *entry, UINT int_param, void
entry->hdr.loaded = TRUE;
if ((brush = InterlockedExchangePointer( (void **)&entry->rgb.brush, 0 )))
{
__wine_make_gdi_object_system( brush, FALSE );
make_gdi_object_system( brush, FALSE );
NtGdiDeleteObjectApp( brush );
}
if ((pen = InterlockedExchangePointer( (void **)&entry->rgb.pen, 0 )))
{
__wine_make_gdi_object_system( pen, FALSE );
make_gdi_object_system( pen, FALSE );
NtGdiDeleteObjectApp( pen );
}
return TRUE;
......@@ -4279,17 +4279,38 @@ static COLORREF get_sys_color( int index )
return ret;
}
static HBRUSH get_55aa_brush(void)
{
static const WORD pattern[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
static HBRUSH brush_55aa;
if (!brush_55aa)
{
HBITMAP bitmap = NtGdiCreateBitmap( 8, 8, 1, 1, pattern );
HBRUSH brush = NtGdiCreatePatternBrushInternal( bitmap, FALSE, FALSE );
NtGdiDeleteObjectApp( bitmap );
make_gdi_object_system( brush, TRUE );
if (InterlockedCompareExchangePointer( (void **)&brush_55aa, brush, 0 ))
{
make_gdi_object_system( brush, FALSE );
NtGdiDeleteObjectApp( brush );
}
}
return brush_55aa;
}
static HBRUSH get_sys_color_brush( unsigned int index )
{
if (index == COLOR_55AA_BRUSH) return get_55aa_brush();
if (index >= ARRAY_SIZE( system_colors )) return 0;
if (!system_colors[index].brush)
{
HBRUSH brush = NtGdiCreateSolidBrush( get_sys_color( index ), NULL );
__wine_make_gdi_object_system( brush, TRUE );
make_gdi_object_system( brush, TRUE );
if (InterlockedCompareExchangePointer( (void **)&system_colors[index].brush, brush, 0 ))
{
__wine_make_gdi_object_system( brush, FALSE );
make_gdi_object_system( brush, FALSE );
NtGdiDeleteObjectApp( brush );
}
}
......@@ -4303,10 +4324,10 @@ static HPEN get_sys_color_pen( unsigned int index )
if (!system_colors[index].pen)
{
HPEN pen = NtGdiCreatePen( PS_SOLID, 1, get_sys_color( index ), NULL );
__wine_make_gdi_object_system( pen, TRUE );
make_gdi_object_system( pen, TRUE );
if (InterlockedCompareExchangePointer( (void **)&system_colors[index].pen, pen, 0 ))
{
__wine_make_gdi_object_system( pen, FALSE );
make_gdi_object_system( pen, FALSE );
NtGdiDeleteObjectApp( pen );
}
}
......
......@@ -1324,7 +1324,6 @@
@ stdcall GetDCHook(long ptr)
@ stdcall SetDCHook(long ptr long)
@ stdcall SetHookFlags(long long)
@ cdecl __wine_make_gdi_object_system(long long)
@ cdecl __wine_set_visible_region(long long ptr ptr ptr)
# Graphics drivers
......
......@@ -235,7 +235,6 @@ struct unix_funcs
BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename );
const struct vulkan_funcs * (CDECL *get_vulkan_driver)( HDC hdc, UINT version );
struct opengl_funcs * (CDECL *get_wgl_driver)( HDC hdc, UINT version );
void (CDECL *make_gdi_object_system)( HGDIOBJ handle, BOOL set );
void (CDECL *set_display_driver)( struct user_driver_funcs *funcs, UINT version );
void (CDECL *set_visible_region)( HDC hdc, HRGN hrgn, const RECT *vis_rect, const RECT *device_rect,
struct window_surface *surface );
......
......@@ -877,12 +877,6 @@ BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCH
return unix_funcs->get_icm_profile( hdc, allow_default, size, filename );
}
void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set )
{
if (!unix_funcs) return;
return unix_funcs->make_gdi_object_system( handle, set );
}
void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect, const RECT *device_rect,
struct window_surface *surface )
{
......
......@@ -66,6 +66,9 @@ enum
NtUserMirrorRgn,
};
/* color index used to retrieve system 55aa brush */
#define COLOR_55AA_BRUSH 0x100
/* this is the structure stored in TEB->Win32ClientInfo */
/* no attempt is made to keep the layout compatible with the Windows one */
struct user_thread_info
......
......@@ -342,7 +342,6 @@ WINGDIAPI DWORD_PTR WINAPI GetDCHook(HDC,DCHOOKPROC*);
WINGDIAPI BOOL WINAPI SetDCHook(HDC,DCHOOKPROC,DWORD_PTR);
WINGDIAPI WORD WINAPI SetHookFlags(HDC,WORD);
extern void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set );
extern void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect,
const RECT *device_rect, struct window_surface *surface );
extern void CDECL __wine_set_display_driver( struct user_driver_funcs *funcs, UINT version );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment