gdi32: Use NtGdiInvertRgn for InvertRgn 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-25 10:57:12 +02:00 committed by Alexandre Julliard
parent a4a27e5846
commit 23f6b8b473
7 changed files with 39 additions and 14 deletions

View File

@ -902,11 +902,11 @@ BOOL CDECL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, IN
}
/*********************************************************************
* EMFDRV_PaintInvertRgn
* EMF_PaintInvertRgn
*
* Helper for EMFDRV_{Paint|Invert}Rgn
*/
static BOOL EMFDRV_PaintInvertRgn( PHYSDEV dev, HRGN hrgn, DWORD iType )
static BOOL EMF_PaintInvertRgn( PHYSDEV dev, HRGN hrgn, DWORD iType )
{
EMRINVERTRGN *emr;
DWORD size, rgnsize;
@ -939,15 +939,24 @@ static BOOL EMFDRV_PaintInvertRgn( PHYSDEV dev, HRGN hrgn, DWORD iType )
*/
BOOL EMFDC_PaintRgn( DC_ATTR *dc_attr, HRGN hrgn )
{
return EMFDRV_PaintInvertRgn( dc_attr->emf, hrgn, EMR_PAINTRGN );
return EMF_PaintInvertRgn( dc_attr->emf, hrgn, EMR_PAINTRGN );
}
/**********************************************************************
* EMF_InvertRgn
*/
BOOL EMFDC_InvertRgn( DC_ATTR *dc_attr, HRGN hrgn )
{
return EMF_PaintInvertRgn( dc_attr->emf, hrgn, EMR_INVERTRGN );
}
/*********************************************************************
* EMFDRV_InvertRgn
*/
BOOL CDECL EMFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn )
{
return EMFDRV_PaintInvertRgn( dev, hrgn, EMR_INVERTRGN );
/* FIXME: update bounding rect */
return TRUE;
}
/**********************************************************************

View File

@ -51,6 +51,7 @@ extern BOOL METADC_ExtTextOut( HDC hdc, INT x, INT y, UINT flags, const RECT *re
const WCHAR *str, UINT count, const INT *dx ) DECLSPEC_HIDDEN;
extern BOOL METADC_FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush ) DECLSPEC_HIDDEN;
extern BOOL METADC_FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL METADC_InvertRgn( HDC hdc, HRGN hrgn ) DECLSPEC_HIDDEN;
extern BOOL METADC_LineTo( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL METADC_MoveTo( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL METADC_PaintRgn( HDC hdc, HRGN hrgn ) DECLSPEC_HIDDEN;
@ -82,6 +83,7 @@ extern BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const
extern BOOL EMFDC_FillRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_FrameRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush, INT width,
INT height ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_InvertRgn( DC_ATTR *dc_attr, HRGN hrgn ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_LineTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_MoveTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_PaintRgn( DC_ATTR *dc_attr, HRGN hrgn ) DECLSPEC_HIDDEN;

View File

@ -428,6 +428,21 @@ BOOL WINAPI FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
return NtGdiFrameRgn( hdc, hrgn, hbrush, width, height );
}
/***********************************************************************
* InvertRgn (GDI32.@)
*/
BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn )
{
DC_ATTR *dc_attr;
TRACE( "%p, %p\n", hdc, hrgn );
if (is_meta_dc( hdc )) return METADC_InvertRgn( hdc, hrgn );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_InvertRgn( dc_attr, hrgn )) return FALSE;
return NtGdiInvertRgn( hdc, hrgn );
}
/***********************************************************************
* ExtTextOutW (GDI32.@)
*/

View File

@ -369,15 +369,17 @@ BOOL METADC_PaintRgn( HDC hdc, HRGN hrgn )
/**********************************************************************
* MFDRV_InvertRgn
* METADC_InvertRgn
*/
BOOL CDECL MFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn )
BOOL METADC_InvertRgn( HDC hdc, HRGN hrgn )
{
METAFILEDRV_PDEVICE *mf;
INT16 index;
index = MFDRV_CreateRegion( dev, hrgn );
if (!(mf = get_metadc_ptr( hdc ))) return FALSE;
index = MFDRV_CreateRegion( &mf->dev, hrgn );
if(index == -1)
return FALSE;
return MFDRV_MetaParam1( dev, META_INVERTREGION, index );
return MFDRV_MetaParam1( &mf->dev, META_INVERTREGION, index );
}

View File

@ -158,7 +158,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pGetTextMetrics */
NULL, /* pGradientFill */
MFDRV_IntersectClipRect, /* pIntersectClipRect */
MFDRV_InvertRgn, /* pInvertRgn */
NULL, /* pInvertRgn */
NULL, /* pLineTo */
NULL, /* pModifyWorldTransform */
NULL, /* pMoveTo */

View File

@ -86,7 +86,6 @@ extern BOOL CDECL MFDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_FlattenPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;

View File

@ -509,16 +509,14 @@ BOOL WINAPI NtGdiFrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, INT width, INT hei
/***********************************************************************
* InvertRgn (GDI32.@)
* NtGdiInvertRgn (win32u.@)
*/
BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn )
BOOL WINAPI NtGdiInvertRgn( HDC hdc, HRGN hrgn )
{
PHYSDEV physdev;
BOOL ret;
DC *dc = get_dc_ptr( hdc );
TRACE( "%p, %p\n", hdc, hrgn );
if (!dc) return FALSE;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pInvertRgn );