Module: wine Branch: master Commit: ab88c7cbb1f7e580a4ae4f4c42a0207481a54a18 URL: https://gitlab.winehq.org/wine/wine/-/commit/ab88c7cbb1f7e580a4ae4f4c42a0207...
Author: Jacek Caban jacek@codeweavers.com Date: Sat May 27 17:48:23 2023 +0200
win32u: Implement NtGdiIcmBrushInfo and use it instead of __wine_get_brush_bitmap_info.
---
dlls/gdi32/emfdc.c | 4 ++-- dlls/gdi32/metadc.c | 5 +++-- dlls/win32u/brush.c | 12 ++++++++++-- dlls/win32u/gdiobj.c | 1 - dlls/win32u/syscall.c | 1 + dlls/win32u/win32u.spec | 3 +-- dlls/win32u/win32u_private.h | 1 - dlls/win32u/wrappers.c | 6 ------ dlls/wow64win/gdi.c | 14 ++++++++++++++ dlls/wow64win/syscall.h | 1 + include/ntgdi.h | 4 ++-- 11 files changed, 34 insertions(+), 18 deletions(-)
diff --git a/dlls/gdi32/emfdc.c b/dlls/gdi32/emfdc.c index 57f39e4c162..45938172a37 100644 --- a/dlls/gdi32/emfdc.c +++ b/dlls/gdi32/emfdc.c @@ -489,7 +489,7 @@ static DWORD emfdc_create_brush( struct emf *emf, HBRUSH brush ) DWORD info_size; UINT usage;
- if (!__wine_get_brush_bitmap_info( brush, info, NULL, &usage )) break; + if (!NtGdiIcmBrushInfo( 0, brush, info, NULL, NULL, &usage, NULL, 0 )) break; info_size = get_dib_info_size( info, usage );
emr = HeapAlloc( GetProcessHeap(), 0, @@ -530,7 +530,7 @@ static DWORD emfdc_create_brush( struct emf *emf, HBRUSH brush ) if (info->bmiHeader.biClrUsed == 1 << info->bmiHeader.biBitCount) info->bmiHeader.biClrUsed = 0; memcpy( (BYTE *)emr + emr->offBmi, info, emr->cbBmi ); - __wine_get_brush_bitmap_info( brush, NULL, (char *)emr + emr->offBits, NULL ); + NtGdiIcmBrushInfo( 0, brush, NULL, (char *)emr + emr->offBits, NULL, NULL, NULL, 0 );
if (!emfdc_record( emf, &emr->emr )) index = 0; HeapFree( GetProcessHeap(), 0, emr ); diff --git a/dlls/gdi32/metadc.c b/dlls/gdi32/metadc.c index 2f5842ea90a..dbfa311b711 100644 --- a/dlls/gdi32/metadc.c +++ b/dlls/gdi32/metadc.c @@ -547,7 +547,8 @@ static INT16 metadc_create_brush( struct metadc *metadc, HBRUSH brush ) DWORD info_size; UINT usage;
- if (!__wine_get_brush_bitmap_info( brush, src_info, NULL, &usage )) goto done; + if (!NtGdiIcmBrushInfo( 0, brush, src_info, NULL, NULL, &usage, NULL, 0 )) + goto done;
info_size = get_dib_info_size( src_info, usage ); size = FIELD_OFFSET( METARECORD, rdParm[2] ) + @@ -559,7 +560,7 @@ static INT16 metadc_create_brush( struct metadc *metadc, HBRUSH brush ) mr->rdParm[0] = logbrush.lbStyle; mr->rdParm[1] = usage; dst_info = (BITMAPINFO *)(mr->rdParm + 2); - __wine_get_brush_bitmap_info( brush, dst_info, (char *)dst_info + info_size, NULL ); + NtGdiIcmBrushInfo( 0, brush, dst_info, (char *)dst_info + info_size, NULL, NULL, NULL, 0 ); if (dst_info->bmiHeader.biClrUsed == 1 << dst_info->bmiHeader.biBitCount) dst_info->bmiHeader.biClrUsed = 0; break; diff --git a/dlls/win32u/brush.c b/dlls/win32u/brush.c index 8523826627e..29a96035599 100644 --- a/dlls/win32u/brush.c +++ b/dlls/win32u/brush.c @@ -145,13 +145,20 @@ void free_brush_pattern( struct brush_pattern *pattern ) }
/********************************************************************** - * __wine_get_brush_bitmap_info (win32u.@) + * NtGdiIcmBrushInfo (win32u.@) */ -BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage ) +BOOL WINAPI NtGdiIcmBrushInfo( HDC hdc, HBRUSH handle, BITMAPINFO *info, void *bits, + ULONG *bits_size, UINT *usage, BOOL *unk, UINT mode ) { BRUSHOBJ *brush; BOOL ret = FALSE;
+ if (mode) + { + FIXME( "unsupported mode %u\n", mode ); + return FALSE; + } + if (!(brush = GDI_GetObjPtr( handle, NTGDI_OBJ_BRUSH ))) return FALSE;
if (brush->pattern.info) @@ -183,6 +190,7 @@ BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void * else memcpy( bits, brush->pattern.bits.ptr, brush->pattern.info->bmiHeader.biSizeImage ); } + if (bits_size) *bits_size = brush->pattern.info->bmiHeader.biSizeImage; if (usage) *usage = brush->pattern.usage; ret = TRUE; } diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index 44eac99a30d..be8d3099a49 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1031,7 +1031,6 @@ BOOL WINAPI NtGdiSetColorAdjustment( HDC hdc, const COLORADJUSTMENT *ca ) static struct unix_funcs unix_funcs = { SetDIBits, - __wine_get_brush_bitmap_info, __wine_get_file_outline_text_metric, __wine_get_icm_profile, __wine_send_input, diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index a292fccd1f7..5e342342362 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -145,6 +145,7 @@ static void * const syscalls[] = NtGdiGetTransform, NtGdiGradientFill, NtGdiHfontCreate, + NtGdiIcmBrushInfo, NtGdiInitSpool, NtGdiIntersectClipRect, NtGdiInvertRgn, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 9fef6d021d4..219442c30eb 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -530,7 +530,7 @@ @ stub NtGdiHT_Get8BPPFormatPalette @ stub NtGdiHT_Get8BPPMaskPalette @ stdcall -syscall NtGdiHfontCreate(ptr long long long ptr) -@ stub NtGdiIcmBrushInfo +@ stdcall -syscall NtGdiIcmBrushInfo(long long ptr ptr ptr ptr ptr long) @ stub NtGdiInit @ stdcall -syscall NtGdiInitSpool() @ stdcall -syscall NtGdiIntersectClipRect(long long long long long) @@ -1325,6 +1325,5 @@
# gdi32 @ stdcall SetDIBits(long long long long ptr ptr long) -@ cdecl __wine_get_brush_bitmap_info(long ptr ptr ptr) @ cdecl __wine_get_icm_profile(long long ptr ptr) @ cdecl __wine_get_file_outline_text_metric(wstr ptr) diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index cf9167aa2d2..7b09ff9aa37 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -38,7 +38,6 @@ struct unix_funcs INT (WINAPI *pSetDIBits)( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines, const void *bits, const BITMAPINFO *info, UINT coloruse ); - BOOL (CDECL *get_brush_bitmap_info)( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage ); BOOL (CDECL *get_file_outline_text_metric)( const WCHAR *path, OUTLINETEXTMETRICW *otm ); BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); BOOL (CDECL *wine_send_input)( HWND hwnd, const INPUT *input, const RAWINPUT *rawinput ); diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index c89c0f16edc..0327416e018 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -38,12 +38,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 ); }
-BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage ) -{ - if (!unix_funcs) return FALSE; - return unix_funcs->get_brush_bitmap_info( handle, info, bits, usage ); -} - BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTMETRICW *otm ) { if (!unix_funcs) return FALSE; diff --git a/dlls/wow64win/gdi.c b/dlls/wow64win/gdi.c index 7b5ca3f90ef..b1c79c776d7 100644 --- a/dlls/wow64win/gdi.c +++ b/dlls/wow64win/gdi.c @@ -1377,6 +1377,20 @@ NTSTATUS WINAPI wow64_NtGdiGradientFill( UINT *args ) return NtGdiGradientFill( hdc, vert_array, nvert, grad_array, ngrad, mode ); }
+NTSTATUS WINAPI wow64_NtGdiIcmBrushInfo( UINT *args ) +{ + HDC hdc = get_handle( &args ); + HBRUSH handle = get_handle( &args ); + BITMAPINFO *info = get_ptr( &args ); + void *bits = get_ptr( &args ); + ULONG *bits_size = get_ptr( &args ); + UINT *usage = get_ptr( &args ); + BOOL *unk = get_ptr( &args ); + UINT mode = get_ulong( &args ); + + return NtGdiIcmBrushInfo( hdc, handle, info, bits, bits_size, usage, unk, mode ); +} + NTSTATUS WINAPI wow64_NtGdiInvertRgn( UINT *args ) { HDC hdc = get_handle( &args ); diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index d2f9cde6d50..0521ad900d8 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -131,6 +131,7 @@ SYSCALL_ENTRY( NtGdiGetTransform ) \ SYSCALL_ENTRY( NtGdiGradientFill ) \ SYSCALL_ENTRY( NtGdiHfontCreate ) \ + SYSCALL_ENTRY( NtGdiIcmBrushInfo ) \ SYSCALL_ENTRY( NtGdiInitSpool ) \ SYSCALL_ENTRY( NtGdiIntersectClipRect ) \ SYSCALL_ENTRY( NtGdiInvertRgn ) \ diff --git a/include/ntgdi.h b/include/ntgdi.h index 0f989189045..e1c5008e4e9 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -375,6 +375,8 @@ BOOL WINAPI NtGdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert, void *grad_array, ULONG ngrad, ULONG mode ); HFONT WINAPI NtGdiHfontCreate( const void *logfont, ULONG unk2, ULONG unk3, ULONG unk4, void *data ); +BOOL WINAPI NtGdiIcmBrushInfo( HDC hdc, HBRUSH handle, BITMAPINFO *info, void *bits, + ULONG *bits_size, UINT *usage, BOOL *unk, UINT mode ); DWORD WINAPI NtGdiInitSpool(void); INT WINAPI NtGdiIntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom ); BOOL WINAPI NtGdiInvertRgn( HDC hdc, HRGN hrgn ); @@ -481,8 +483,6 @@ NTSTATUS WINAPI NtGdiDdDDISetQueuedLimit( D3DKMT_SETQUEUEDLIMIT *desc ); NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc );
/* Wine extensions */ -extern BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, - UINT *usage ); extern BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ); extern BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path,