gdi32: Use NtGdiSaveDC for SaveDC 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:
parent
fa7c939d02
commit
d423244c1b
|
@ -577,9 +577,9 @@ static BOOL reset_dc_state( HDC hdc )
|
|||
|
||||
|
||||
/***********************************************************************
|
||||
* SaveDC (GDI32.@)
|
||||
* NtGdiSaveDC (win32u.@)
|
||||
*/
|
||||
INT WINAPI SaveDC( HDC hdc )
|
||||
INT WINAPI NtGdiSaveDC( HDC hdc )
|
||||
{
|
||||
DC * dc;
|
||||
INT ret = 0;
|
||||
|
|
|
@ -22,19 +22,12 @@
|
|||
#include <assert.h>
|
||||
#include "enhmfdrv/enhmetafiledrv.h"
|
||||
|
||||
INT CDECL EMFDRV_SaveDC( PHYSDEV dev )
|
||||
BOOL EMFDC_SaveDC( DC_ATTR *dc_attr )
|
||||
{
|
||||
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSaveDC );
|
||||
INT ret = next->funcs->pSaveDC( next );
|
||||
|
||||
if (ret)
|
||||
{
|
||||
EMRSAVEDC emr;
|
||||
emr.emr.iType = EMR_SAVEDC;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
EMFDRV_WriteRecord( dev, &emr.emr );
|
||||
}
|
||||
return ret;
|
||||
EMRSAVEDC emr;
|
||||
emr.emr.iType = EMR_SAVEDC;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
|
||||
}
|
||||
|
||||
BOOL CDECL EMFDRV_RestoreDC( PHYSDEV dev, INT level )
|
||||
|
|
|
@ -102,7 +102,6 @@ extern BOOL CDECL EMFDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT righ
|
|||
extern BOOL CDECL EMFDRV_RestoreDC( PHYSDEV dev, INT level ) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL EMFDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
||||
INT ell_width, INT ell_height ) DECLSPEC_HIDDEN;
|
||||
extern INT CDECL EMFDRV_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL EMFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom,
|
||||
INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL EMFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom,
|
||||
|
|
|
@ -118,7 +118,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
|
|||
NULL, /* pResetDC */
|
||||
EMFDRV_RestoreDC, /* pRestoreDC */
|
||||
EMFDRV_RoundRect, /* pRoundRect */
|
||||
EMFDRV_SaveDC, /* pSaveDC */
|
||||
NULL, /* pSaveDC */
|
||||
EMFDRV_ScaleViewportExtEx, /* pScaleViewportExtEx */
|
||||
EMFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */
|
||||
EMFDRV_SelectBitmap, /* pSelectBitmap */
|
||||
|
|
|
@ -66,6 +66,7 @@ extern BOOL METADC_Polyline( HDC hdc, const POINT *points,INT count) DECLSPEC_HI
|
|||
extern BOOL METADC_Rectangle( HDC hdc, INT left, INT top, INT right, INT bottom) DECLSPEC_HIDDEN;
|
||||
extern BOOL METADC_RoundRect( HDC hdc, INT left, INT top, INT right, INT bottom,
|
||||
INT ell_width, INT ell_height ) DECLSPEC_HIDDEN;
|
||||
extern BOOL METADC_SaveDC( HDC hdc ) DECLSPEC_HIDDEN;
|
||||
extern BOOL METADC_SetBkMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern BOOL METADC_SetPixel( HDC hdc, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
extern BOOL METADC_SetPolyFillMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
|
||||
|
@ -114,6 +115,7 @@ extern BOOL EMFDC_Rectangle( DC_ATTR *dc_attr, INT left, INT top, INT right,
|
|||
INT bottom) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_RoundRect( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom,
|
||||
INT ell_width, INT ell_height ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_SaveDC( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_SetArcDirection( DC_ATTR *dc_attr, INT dir ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_SetBkMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_SetPixel( DC_ATTR *dc_attr, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -112,6 +112,19 @@ HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode )
|
|||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* SaveDC (GDI32.@)
|
||||
*/
|
||||
INT WINAPI SaveDC( HDC hdc )
|
||||
{
|
||||
DC_ATTR *dc_attr;
|
||||
|
||||
if (is_meta_dc( hdc )) return METADC_SaveDC( hdc );
|
||||
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
|
||||
if (dc_attr->emf && !EMFDC_SaveDC( dc_attr )) return FALSE;
|
||||
return NtGdiSaveDC( hdc );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetTextAlign (GDI32.@)
|
||||
*/
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
#include "mfdrv/metafiledrv.h"
|
||||
|
||||
INT CDECL MFDRV_SaveDC( PHYSDEV dev )
|
||||
BOOL METADC_SaveDC( HDC hdc )
|
||||
{
|
||||
return MFDRV_MetaParam0( dev, META_SAVEDC );
|
||||
return metadc_param0( hdc, META_SAVEDC );
|
||||
}
|
||||
|
||||
BOOL CDECL MFDRV_RestoreDC( PHYSDEV dev, INT level )
|
||||
|
|
|
@ -181,7 +181,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
|
|||
NULL, /* pResetDC */
|
||||
MFDRV_RestoreDC, /* pRestoreDC */
|
||||
NULL, /* pRoundRect */
|
||||
MFDRV_SaveDC, /* pSaveDC */
|
||||
NULL, /* pSaveDC */
|
||||
MFDRV_ScaleViewportExtEx, /* pScaleViewportExtEx */
|
||||
MFDRV_ScaleWindowExtEx, /* pScaleWindowExtEx */
|
||||
MFDRV_SelectBitmap, /* pSelectBitmap */
|
||||
|
@ -613,6 +613,14 @@ BOOL metadc_param1( HDC hdc, short func, short param )
|
|||
return MFDRV_MetaParam1( &dev->dev, func, param );
|
||||
}
|
||||
|
||||
BOOL metadc_param0( HDC hdc, short func )
|
||||
{
|
||||
METAFILEDRV_PDEVICE *dev;
|
||||
|
||||
if (!(dev = get_metadc_ptr( hdc ))) return FALSE;
|
||||
return MFDRV_MetaParam0( &dev->dev, func );
|
||||
}
|
||||
|
||||
BOOL metadc_param2( HDC hdc, short func, short param1, short param2 )
|
||||
{
|
||||
METAFILEDRV_PDEVICE *dev;
|
||||
|
|
|
@ -60,6 +60,7 @@ extern BOOL MFDRV_RemoveHandle( PHYSDEV dev, UINT index ) DECLSPEC_HIDDEN;
|
|||
extern INT16 MFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush ) DECLSPEC_HIDDEN;
|
||||
|
||||
extern METAFILEDRV_PDEVICE *get_metadc_ptr( HDC hdc ) DECLSPEC_HIDDEN;
|
||||
extern BOOL metadc_param0( HDC hdc, short func ) DECLSPEC_HIDDEN;
|
||||
extern BOOL metadc_param1( HDC hdc, short func, short param ) DECLSPEC_HIDDEN;
|
||||
extern BOOL metadc_param2( HDC hdc, short func, short param1, short param2 ) DECLSPEC_HIDDEN;
|
||||
extern BOOL metadc_param4( HDC hdc, short func, short param1, short param2,
|
||||
|
@ -95,7 +96,6 @@ extern BOOL CDECL MFDRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD ro
|
|||
extern BOOL CDECL MFDRV_PolyBezier( PHYSDEV dev, const POINT* pt, DWORD count ) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL MFDRV_PolyBezierTo( PHYSDEV dev, const POINT* pt, DWORD count ) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL MFDRV_RestoreDC( PHYSDEV dev, INT level ) DECLSPEC_HIDDEN;
|
||||
extern INT CDECL MFDRV_SaveDC( PHYSDEV dev ) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL MFDRV_ScaleViewportExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL MFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN;
|
||||
extern HBITMAP CDECL MFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -234,6 +234,11 @@ static void test_savedc(void)
|
|||
"ret = %d\n", ret);
|
||||
|
||||
DeleteDC(hdc);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SaveDC(ULongToHandle(0xdeadbeef));
|
||||
ok(!ret, "SaveDC returned %u\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_GdiConvertToDevmodeW(void)
|
||||
|
|
Loading…
Reference in New Issue