gdi32: Use NtGdiFrameRgn for FrameRgn 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:56:56 +02:00 committed by Alexandre Julliard
parent a3a5c7048f
commit a4a27e5846
7 changed files with 46 additions and 18 deletions

View File

@ -856,15 +856,16 @@ BOOL CDECL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush )
/*********************************************************************
* EMFDRV_FrameRgn
* EMFDC_FrameRgn
*/
BOOL CDECL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
BOOL EMFDC_FrameRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
{
EMFDRV_PDEVICE *emf = dc_attr->emf;
EMRFRAMERGN *emr;
DWORD size, rgnsize, index;
BOOL ret;
index = EMFDRV_CreateBrushIndirect( dev, hbrush );
index = EMFDRV_CreateBrushIndirect( &emf->dev, hbrush );
if(!index) return FALSE;
rgnsize = NtGdiGetRegionData( hrgn, 0, NULL );
@ -884,13 +885,22 @@ BOOL CDECL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, IN
emr->szlStroke.cx = width;
emr->szlStroke.cy = height;
ret = EMFDRV_WriteRecord( dev, &emr->emr );
ret = EMFDRV_WriteRecord( &emf->dev, &emr->emr );
if(ret)
EMFDRV_UpdateBBox( dev, &emr->rclBounds );
EMFDRV_UpdateBBox( &emf->dev, &emr->rclBounds );
HeapFree( GetProcessHeap(), 0, emr );
return ret;
}
/*********************************************************************
* EMFDRV_FrameRgn
*/
BOOL CDECL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
{
/* FIXME: update bounding rect */
return TRUE;
}
/*********************************************************************
* EMFDRV_PaintInvertRgn
*

View File

@ -50,6 +50,7 @@ extern BOOL METADC_Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom )
extern BOOL METADC_ExtTextOut( HDC hdc, INT x, INT y, UINT flags, const RECT *rect,
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_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;
@ -79,6 +80,8 @@ extern BOOL EMFDC_EndPath( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const RECT *rect,
const WCHAR *str, UINT count, const INT *dx ) DECLSPEC_HIDDEN;
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_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

@ -412,6 +412,22 @@ BOOL WINAPI PaintRgn( HDC hdc, HRGN hrgn )
return NtGdiFillRgn( hdc, hrgn, GetCurrentObject( hdc, OBJ_BRUSH ));
}
/***********************************************************************
* FrameRgn (GDI32.@)
*/
BOOL WINAPI FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
{
DC_ATTR *dc_attr;
TRACE( "%p, %p, %p, %dx%d\n", hdc, hrgn, hbrush, width, height );
if (is_meta_dc( hdc )) return METADC_FrameRgn( hdc, hrgn, hbrush, width, height );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_FrameRgn( dc_attr, hrgn, hbrush, width, height ))
return FALSE;
return NtGdiFrameRgn( hdc, hrgn, hbrush, width, height );
}
/***********************************************************************
* ExtTextOutW (GDI32.@)
*/

View File

@ -409,18 +409,21 @@ BOOL CDECL MFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush )
}
/**********************************************************************
* MFDRV_FrameRgn
* METADC_FrameRgn
*/
BOOL CDECL MFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT x, INT y )
BOOL METADC_FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, INT x, INT y )
{
METAFILEDRV_PDEVICE *mf;
INT16 iRgn, iBrush;
iRgn = MFDRV_CreateRegion( dev, hrgn );
if (!(mf = get_metadc_ptr( hdc ))) return FALSE;
iRgn = MFDRV_CreateRegion( &mf->dev, hrgn );
if(iRgn == -1)
return FALSE;
iBrush = MFDRV_CreateBrushIndirect( dev, hbrush );
iBrush = MFDRV_CreateBrushIndirect( &mf->dev, hbrush );
if(!iBrush)
return FALSE;
return MFDRV_MetaParam4( dev, META_FRAMEREGION, iRgn, iBrush, x, y );
return MFDRV_MetaParam4( &mf->dev, META_FRAMEREGION, iRgn, iBrush, x, y );
}

View File

@ -130,7 +130,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
MFDRV_FillRgn, /* pFillRgn */
MFDRV_FlattenPath, /* pFlattenPath */
NULL, /* pFontIsLinked */
MFDRV_FrameRgn, /* pFrameRgn */
NULL, /* pFrameRgn */
NULL, /* pGdiComment */
MFDRV_GetBoundsRect, /* pGetBoundsRect */
NULL, /* pGetCharABCWidths */

View File

@ -85,7 +85,6 @@ extern INT CDECL MFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode ) DEC
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 BOOL CDECL MFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT x, INT y ) 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;

View File

@ -491,21 +491,18 @@ BOOL WINAPI NtGdiFillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush )
/***********************************************************************
* FrameRgn (GDI32.@)
* NtGdiFrameRgn (win32u.@)
*/
BOOL WINAPI FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush,
INT nWidth, INT nHeight )
BOOL WINAPI NtGdiFrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
{
PHYSDEV physdev;
BOOL ret;
DC *dc = get_dc_ptr( hdc );
TRACE( "%p, %p, %p, %dx%d\n", hdc, hrgn, hbrush, nWidth, nHeight );
if (!dc) return FALSE;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pFrameRgn );
ret = physdev->funcs->pFrameRgn( physdev, hrgn, hbrush, nWidth, nHeight );
ret = physdev->funcs->pFrameRgn( physdev, hrgn, hbrush, width, height );
release_dc_ptr( dc );
return ret;
}