From e33cdf89c5a071c652584c24a46ab9ecf4d5a750 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 23 Aug 2021 13:50:47 +0200 Subject: [PATCH] gdi32: Use NtGdiResetDC for ResetDCW. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/gdi32/dc.c | 17 +++++++++-------- dlls/gdi32/driver.c | 4 ++-- dlls/gdi32/gdidc.c | 8 ++++++++ dlls/wineps.drv/init.c | 4 ++-- include/ntgdi.h | 4 +++- include/wine/gdi_driver.h | 4 ++-- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index e4f643389d5..fa15b43fc8b 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -770,17 +770,18 @@ BOOL WINAPI DeleteDC( HDC hdc ) /*********************************************************************** - * ResetDCW (GDI32.@) + * NtGdiResetDC (win32u.@) */ -HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode ) +BOOL WINAPI NtGdiResetDC( HDC hdc, const DEVMODEW *devmode, BOOL *banding, + DRIVER_INFO_2W *driver_info, void *dev ) { DC *dc; - HDC ret = 0; + BOOL ret = FALSE; if ((dc = get_dc_ptr( hdc ))) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pResetDC ); - ret = physdev->funcs->pResetDC( physdev, devmode ); + ret = physdev->funcs->pResetDC( physdev, devmode ) != 0; if (ret) /* reset the visible region */ { dc->dirty = 0; @@ -788,7 +789,7 @@ HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode ) dc->attr->vis_rect.top = 0; dc->attr->vis_rect.right = GetDeviceCaps( hdc, DESKTOPHORZRES ); dc->attr->vis_rect.bottom = GetDeviceCaps( hdc, DESKTOPVERTRES ); - if (dc->hVisRgn) DeleteObject( dc->hVisRgn ); + if (dc->hVisRgn) NtGdiDeleteObjectApp( dc->hVisRgn ); dc->hVisRgn = 0; update_dc_clipping( dc ); } @@ -996,7 +997,7 @@ BOOL WINAPI CombineTransform( LPXFORM xformResult, const XFORM *xform1, /*********************************************************************** - * SetDCHook (GDI32.@) + * SetDCHook (win32u.@) * * Note: this doesn't exist in Win32, we add it here because user32 needs it. */ @@ -1014,7 +1015,7 @@ BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD_PTR dwHookData ) /*********************************************************************** - * GetDCHook (GDI32.@) + * GetDCHook (win32u.@) * * Note: this doesn't exist in Win32, we add it here because user32 needs it. */ @@ -1032,7 +1033,7 @@ DWORD_PTR WINAPI GetDCHook( HDC hdc, DCHOOKPROC *proc ) /*********************************************************************** - * SetHookFlags (GDI32.@) + * SetHookFlags (win32u.@) * * Note: this doesn't exist in Win32, we add it here because user32 needs it. */ diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 23bfc87a761..1df4660211e 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -720,9 +720,9 @@ static BOOL CDECL nulldrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, return TRUE; } -static HDC CDECL nulldrv_ResetDC( PHYSDEV dev, const DEVMODEW *devmode ) +static BOOL CDECL nulldrv_ResetDC( PHYSDEV dev, const DEVMODEW *devmode ) { - return 0; + return FALSE; } static BOOL CDECL nulldrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom, diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c index 68bffdfbac3..0b005944f93 100644 --- a/dlls/gdi32/gdidc.c +++ b/dlls/gdi32/gdidc.c @@ -112,6 +112,14 @@ HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode ) return ret; } +/*********************************************************************** + * ResetDCW (GDI32.@) + */ +HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode ) +{ + return NtGdiResetDC( hdc, devmode, NULL, NULL, NULL ) ? hdc : 0; +} + /*********************************************************************** * SaveDC (GDI32.@) */ diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c index 7b6a8f3d67b..58542c19811 100644 --- a/dlls/wineps.drv/init.c +++ b/dlls/wineps.drv/init.c @@ -448,7 +448,7 @@ static BOOL CDECL PSDRV_DeleteDC( PHYSDEV dev ) /********************************************************************** * ResetDC (WINEPS.@) */ -static HDC CDECL PSDRV_ResetDC( PHYSDEV dev, const DEVMODEW *lpInitData ) +static BOOL CDECL PSDRV_ResetDC( PHYSDEV dev, const DEVMODEW *lpInitData ) { PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); @@ -457,7 +457,7 @@ static HDC CDECL PSDRV_ResetDC( PHYSDEV dev, const DEVMODEW *lpInitData ) PSDRV_MergeDevmodes(physDev->Devmode, (const PSDRV_DEVMODE *)lpInitData, physDev->pi); PSDRV_UpdateDevCaps(physDev); } - return dev->hdc; + return TRUE; } /*********************************************************************** diff --git a/include/ntgdi.h b/include/ntgdi.h index cec0d3d10f1..03b476e349c 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -20,6 +20,7 @@ #define _NTGDI_ #include +#include typedef struct _GDI_HANDLE_ENTRY { @@ -268,7 +269,8 @@ BOOL WINAPI NtGdiPtVisible( HDC hdc, INT x, INT y ); BOOL WINAPI NtGdiRectInRegion( HRGN hrgn, const RECT *rect ); BOOL WINAPI NtGdiRectVisible( HDC hdc, const RECT *rect ); BOOL WINAPI NtGdiRectangle( HDC hdc, INT left, INT top, INT right, INT bottom ); -HDC WINAPI NtGdiResetDC( HDC hdc, const DEVMODEW *devmode ); +BOOL WINAPI NtGdiResetDC( HDC hdc, const DEVMODEW *devmode, BOOL *banding, + DRIVER_INFO_2W *driver_info, void *dev ); BOOL WINAPI NtGdiResizePalette( HPALETTE palette, UINT count ); BOOL WINAPI NtGdiRestoreDC( HDC hdc, INT level ); BOOL WINAPI NtGdiRoundRect( HDC hdc, INT left, INT top, INT right, diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 641d74ea82e..5ca84ccf56c 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -137,7 +137,7 @@ struct gdi_dc_funcs UINT (CDECL *pRealizeDefaultPalette)(PHYSDEV); UINT (CDECL *pRealizePalette)(PHYSDEV,HPALETTE,BOOL); BOOL (CDECL *pRectangle)(PHYSDEV,INT,INT,INT,INT); - HDC (CDECL *pResetDC)(PHYSDEV,const DEVMODEW*); + BOOL (CDECL *pResetDC)(PHYSDEV,const DEVMODEW*); BOOL (CDECL *pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT); HBITMAP (CDECL *pSelectBitmap)(PHYSDEV,HBITMAP); HBRUSH (CDECL *pSelectBrush)(PHYSDEV,HBRUSH,const struct brush_pattern*); @@ -169,7 +169,7 @@ struct gdi_dc_funcs }; /* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 63 +#define WINE_GDI_DRIVER_VERSION 64 #define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */