gdi32: Don't use driver entry point for NtGdiSaveDC implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-07-30 13:02:30 +02:00 committed by Alexandre Julliard
parent d423244c1b
commit eefca28ed3
14 changed files with 60 additions and 81 deletions

View file

@ -379,67 +379,6 @@ void DC_UpdateXforms( DC *dc )
}
/***********************************************************************
* nulldrv_SaveDC
*/
INT CDECL nulldrv_SaveDC( PHYSDEV dev )
{
DC *newdc, *dc = get_nulldrv_dc( dev );
if (!(newdc = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*newdc )))) return 0;
if (!(newdc->attr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*newdc->attr) )))
{
HeapFree( GetProcessHeap(), 0, newdc );
return 0;
}
*newdc->attr = *dc->attr;
newdc->hPen = dc->hPen;
newdc->hBrush = dc->hBrush;
newdc->hFont = dc->hFont;
newdc->hBitmap = dc->hBitmap;
newdc->hPalette = dc->hPalette;
newdc->brush_org = dc->brush_org;
newdc->mapperFlags = dc->mapperFlags;
newdc->charExtra = dc->charExtra;
newdc->breakExtra = dc->breakExtra;
newdc->breakRem = dc->breakRem;
newdc->xformWorld2Wnd = dc->xformWorld2Wnd;
newdc->xformWorld2Vport = dc->xformWorld2Vport;
newdc->xformVport2World = dc->xformVport2World;
newdc->vport2WorldValid = dc->vport2WorldValid;
newdc->wnd_org = dc->wnd_org;
newdc->wnd_ext = dc->wnd_ext;
newdc->vport_org = dc->vport_org;
newdc->vport_ext = dc->vport_ext;
newdc->virtual_res = dc->virtual_res;
newdc->virtual_size = dc->virtual_size;
/* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */
if (dc->hClipRgn)
{
newdc->hClipRgn = NtGdiCreateRectRgn( 0, 0, 0, 0 );
NtGdiCombineRgn( newdc->hClipRgn, dc->hClipRgn, 0, RGN_COPY );
}
if (dc->hMetaRgn)
{
newdc->hMetaRgn = NtGdiCreateRectRgn( 0, 0, 0, 0 );
NtGdiCombineRgn( newdc->hMetaRgn, dc->hMetaRgn, 0, RGN_COPY );
}
if (!PATH_SavePath( newdc, dc ))
{
release_dc_ptr( dc );
free_dc_state( newdc );
return 0;
}
newdc->saved_dc = dc->saved_dc;
dc->saved_dc = newdc;
return ++dc->saveLevel;
}
/***********************************************************************
* nulldrv_RestoreDC
*/
@ -581,15 +520,69 @@ static BOOL reset_dc_state( HDC hdc )
*/
INT WINAPI NtGdiSaveDC( HDC hdc )
{
DC * dc;
INT ret = 0;
DC *dc, *newdc;
INT ret;
if ((dc = get_dc_ptr( hdc )))
if (!(dc = get_dc_ptr( hdc ))) return 0;
if (!(newdc = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*newdc ))))
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSaveDC );
ret = physdev->funcs->pSaveDC( physdev );
release_dc_ptr( dc );
return 0;
}
if (!(newdc->attr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*newdc->attr) )))
{
HeapFree( GetProcessHeap(), 0, newdc );
release_dc_ptr( dc );
return 0;
}
*newdc->attr = *dc->attr;
newdc->hPen = dc->hPen;
newdc->hBrush = dc->hBrush;
newdc->hFont = dc->hFont;
newdc->hBitmap = dc->hBitmap;
newdc->hPalette = dc->hPalette;
newdc->brush_org = dc->brush_org;
newdc->mapperFlags = dc->mapperFlags;
newdc->charExtra = dc->charExtra;
newdc->breakExtra = dc->breakExtra;
newdc->breakRem = dc->breakRem;
newdc->xformWorld2Wnd = dc->xformWorld2Wnd;
newdc->xformWorld2Vport = dc->xformWorld2Vport;
newdc->xformVport2World = dc->xformVport2World;
newdc->vport2WorldValid = dc->vport2WorldValid;
newdc->wnd_org = dc->wnd_org;
newdc->wnd_ext = dc->wnd_ext;
newdc->vport_org = dc->vport_org;
newdc->vport_ext = dc->vport_ext;
newdc->virtual_res = dc->virtual_res;
newdc->virtual_size = dc->virtual_size;
/* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */
if (dc->hClipRgn)
{
newdc->hClipRgn = NtGdiCreateRectRgn( 0, 0, 0, 0 );
NtGdiCombineRgn( newdc->hClipRgn, dc->hClipRgn, 0, RGN_COPY );
}
if (dc->hMetaRgn)
{
newdc->hMetaRgn = NtGdiCreateRectRgn( 0, 0, 0, 0 );
NtGdiCombineRgn( newdc->hMetaRgn, dc->hMetaRgn, 0, RGN_COPY );
}
if (!PATH_SavePath( newdc, dc ))
{
release_dc_ptr( dc );
free_dc_state( newdc );
return 0;
}
newdc->saved_dc = dc->saved_dc;
dc->saved_dc = newdc;
ret = ++dc->saveLevel;
release_dc_ptr( dc );
return ret;
}

View file

@ -704,7 +704,6 @@ const struct gdi_dc_funcs dib_driver =
NULL, /* pResetDC */
NULL, /* pRestoreDC */
dibdrv_RoundRect, /* pRoundRect */
NULL, /* pSaveDC */
NULL, /* pScaleViewportExt */
NULL, /* pScaleWindowExt */
dibdrv_SelectBitmap, /* pSelectBitmap */
@ -1296,7 +1295,6 @@ static const struct gdi_dc_funcs window_driver =
NULL, /* pResetDC */
NULL, /* pRestoreDC */
windrv_RoundRect, /* pRoundRect */
NULL, /* pSaveDC */
NULL, /* pScaleViewportExt */
NULL, /* pScaleWindowExt */
NULL, /* pSelectBitmap */

View file

@ -951,7 +951,6 @@ const struct gdi_dc_funcs null_driver =
nulldrv_ResetDC, /* pResetDC */
nulldrv_RestoreDC, /* pRestoreDC */
nulldrv_RoundRect, /* pRoundRect */
nulldrv_SaveDC, /* pSaveDC */
nulldrv_ScaleViewportExtEx, /* pScaleViewportExt */
nulldrv_ScaleWindowExtEx, /* pScaleWindowExt */
nulldrv_SelectBitmap, /* pSelectBitmap */

View file

@ -118,7 +118,6 @@ static const struct gdi_dc_funcs emfdrv_driver =
NULL, /* pResetDC */
EMFDRV_RestoreDC, /* pRestoreDC */
EMFDRV_RoundRect, /* pRoundRect */
NULL, /* pSaveDC */
EMFDRV_ScaleViewportExtEx, /* pScaleViewportExtEx */
EMFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */
EMFDRV_SelectBitmap, /* pSelectBitmap */

View file

@ -3895,7 +3895,6 @@ const struct gdi_dc_funcs font_driver =
NULL, /* pResetDC */
NULL, /* pRestoreDC */
NULL, /* pRoundRect */
NULL, /* pSaveDC */
NULL, /* pScaleViewportExt */
NULL, /* pScaleWindowExt */
NULL, /* pSelectBitmap */

View file

@ -181,7 +181,6 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pResetDC */
MFDRV_RestoreDC, /* pRestoreDC */
NULL, /* pRoundRect */
NULL, /* pSaveDC */
MFDRV_ScaleViewportExtEx, /* pScaleViewportExtEx */
MFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */
MFDRV_SelectBitmap, /* pSelectBitmap */

View file

@ -602,7 +602,6 @@ extern BOOL CDECL nulldrv_PolyBezierTo( PHYSDEV dev, const POINT *points, DWORD
extern BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE *types, DWORD count ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_PolylineTo( PHYSDEV dev, const POINT *points, INT count ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level ) DECLSPEC_HIDDEN;
extern INT CDECL nulldrv_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_SelectClipPath( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;

View file

@ -2156,7 +2156,6 @@ const struct gdi_dc_funcs path_driver =
NULL, /* pResetDC */
NULL, /* pRestoreDC */
pathdrv_RoundRect, /* pRoundRect */
NULL, /* pSaveDC */
NULL, /* pScaleViewportExt */
NULL, /* pScaleWindowExt */
NULL, /* pSelectBitmap */

View file

@ -365,7 +365,6 @@ static const struct gdi_dc_funcs android_drv_funcs =
NULL, /* pResetDC */
NULL, /* pRestoreDC */
NULL, /* pRoundRect */
NULL, /* pSaveDC */
NULL, /* pScaleViewportExt */
NULL, /* pScaleWindowExt */
NULL, /* pSelectBitmap */

View file

@ -345,7 +345,6 @@ static const struct gdi_dc_funcs macdrv_funcs =
NULL, /* pResetDC */
NULL, /* pRestoreDC */
NULL, /* pRoundRect */
NULL, /* pSaveDC */
NULL, /* pScaleViewportExt */
NULL, /* pScaleWindowExt */
NULL, /* pSelectBitmap */

View file

@ -859,7 +859,6 @@ static const struct gdi_dc_funcs psdrv_funcs =
PSDRV_ResetDC, /* pResetDC */
NULL, /* pRestoreDC */
PSDRV_RoundRect, /* pRoundRect */
NULL, /* pSaveDC */
NULL, /* pScaleViewportExt */
NULL, /* pScaleWindowExt */
NULL, /* pSelectBitmap */

View file

@ -424,7 +424,6 @@ static const struct gdi_dc_funcs x11drv_funcs =
NULL, /* pResetDC */
NULL, /* pRestoreDC */
X11DRV_RoundRect, /* pRoundRect */
NULL, /* pSaveDC */
NULL, /* pScaleViewportExt */
NULL, /* pScaleWindowExt */
NULL, /* pSelectBitmap */

View file

@ -2236,7 +2236,6 @@ static const struct gdi_dc_funcs xrender_funcs =
NULL, /* pResetDC */
NULL, /* pRestoreDC */
NULL, /* pRoundRect */
NULL, /* pSaveDC */
NULL, /* pScaleViewportExt */
NULL, /* pScaleWindowExt */
NULL, /* pSelectBitmap */

View file

@ -149,7 +149,6 @@ struct gdi_dc_funcs
HDC (CDECL *pResetDC)(PHYSDEV,const DEVMODEW*);
BOOL (CDECL *pRestoreDC)(PHYSDEV,INT);
BOOL (CDECL *pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
INT (CDECL *pSaveDC)(PHYSDEV);
BOOL (CDECL *pScaleViewportExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*);
BOOL (CDECL *pScaleWindowExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*);
HBITMAP (CDECL *pSelectBitmap)(PHYSDEV,HBITMAP);
@ -195,7 +194,7 @@ struct gdi_dc_funcs
};
/* increment this when you change the DC function table */
#define WINE_GDI_DRIVER_VERSION 54
#define WINE_GDI_DRIVER_VERSION 55
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */
#define GDI_PRIORITY_FONT_DRV 100 /* any font driver */