gdi32: Use NtGdiFillRgn for FillRgn 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:11 +02:00 committed by Alexandre Julliard
parent 382d5f769b
commit d552d7ef68
7 changed files with 61 additions and 19 deletions

View file

@ -810,15 +810,16 @@ BOOL CDECL EMFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT
/********************************************************************* /*********************************************************************
* EMFDRV_FillRgn * EMFDC_FillRgn
*/ */
BOOL CDECL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush ) BOOL EMFDC_FillRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush )
{ {
EMFDRV_PDEVICE *emf = dc_attr->emf;
EMRFILLRGN *emr; EMRFILLRGN *emr;
DWORD size, rgnsize, index; DWORD size, rgnsize, index;
BOOL ret; BOOL ret;
index = EMFDRV_CreateBrushIndirect( dev, hbrush ); index = EMFDRV_CreateBrushIndirect( &emf->dev, hbrush );
if(!index) return FALSE; if(!index) return FALSE;
rgnsize = NtGdiGetRegionData( hrgn, 0, NULL ); rgnsize = NtGdiGetRegionData( hrgn, 0, NULL );
@ -836,12 +837,24 @@ BOOL CDECL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush )
emr->cbRgnData = rgnsize; emr->cbRgnData = rgnsize;
emr->ihBrush = index; emr->ihBrush = index;
ret = EMFDRV_WriteRecord( dev, &emr->emr ); ret = EMFDRV_WriteRecord( &emf->dev, &emr->emr );
if(ret) if(ret)
EMFDRV_UpdateBBox( dev, &emr->rclBounds ); EMFDRV_UpdateBBox( &emf->dev, &emr->rclBounds );
HeapFree( GetProcessHeap(), 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret; return ret;
} }
/*********************************************************************
* EMFDRV_FillRgn
*/
BOOL CDECL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush )
{
/* FIXME: update bounding rect */
return TRUE;
}
/********************************************************************* /*********************************************************************
* EMFDRV_FrameRgn * EMFDRV_FrameRgn
*/ */

View file

@ -49,6 +49,7 @@ extern BOOL METADC_Chord( HDC hdc, INT left, INT top, INT right, INT bottom, INT
extern BOOL METADC_Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; extern BOOL METADC_Ellipse( HDC hdc, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern BOOL METADC_ExtTextOut( HDC hdc, INT x, INT y, UINT flags, const RECT *rect, 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; 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_LineTo( HDC hdc, 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_MoveTo( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL METADC_Pie( HDC hdc, INT left, INT top, INT right, INT bottom, extern BOOL METADC_Pie( HDC hdc, INT left, INT top, INT right, INT bottom,
@ -76,6 +77,7 @@ extern BOOL EMFDC_Ellipse( DC_ATTR *dc_attr, INT left, INT top, INT right,
extern BOOL EMFDC_EndPath( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN; 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, 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; 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_LineTo( DC_ATTR *dc_attr, INT x, INT y ) 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_MoveTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_PolyBezier( DC_ATTR *dc_attr, const POINT *points, DWORD count ) DECLSPEC_HIDDEN; extern BOOL EMFDC_PolyBezier( DC_ATTR *dc_attr, const POINT *points, DWORD count ) DECLSPEC_HIDDEN;

View file

@ -382,6 +382,21 @@ BOOL WINAPI PolyDraw( HDC hdc, const POINT *points, const BYTE *types, DWORD cou
return NtGdiPolyDraw( hdc, points, types, count ); return NtGdiPolyDraw( hdc, points, types, count );
} }
/***********************************************************************
* FillRgn (GDI32.@)
*/
BOOL WINAPI FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush )
{
DC_ATTR *dc_attr;
TRACE( "%p, %p, %p\n", hdc, hrgn, hbrush );
if (is_meta_dc( hdc )) return METADC_FillRgn( hdc, hrgn, hbrush );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_FillRgn( dc_attr, hrgn, hbrush )) return FALSE;
return NtGdiFillRgn( hdc, hrgn, hbrush );
}
/*********************************************************************** /***********************************************************************
* ExtTextOutW (GDI32.@) * ExtTextOutW (GDI32.@)
*/ */

View file

@ -379,19 +379,31 @@ BOOL CDECL MFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn )
} }
/**********************************************************************
* METADC_FillRgn
*/
BOOL METADC_FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush )
{
METAFILEDRV_PDEVICE *mf;
INT16 iRgn, iBrush;
if (!(mf = get_metadc_ptr( hdc ))) return FALSE;
iRgn = MFDRV_CreateRegion( &mf->dev, hrgn );
if(iRgn == -1)
return FALSE;
iBrush = MFDRV_CreateBrushIndirect( &mf->dev, hbrush );
if(!iBrush)
return FALSE;
return MFDRV_MetaParam2( &mf->dev, META_FILLREGION, iRgn, iBrush );
}
/********************************************************************** /**********************************************************************
* MFDRV_FillRgn * MFDRV_FillRgn
*/ */
BOOL CDECL MFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush ) BOOL CDECL MFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush )
{ {
INT16 iRgn, iBrush; return TRUE;
iRgn = MFDRV_CreateRegion( dev, hrgn );
if(iRgn == -1)
return FALSE;
iBrush = MFDRV_CreateBrushIndirect( dev, hbrush );
if(!iBrush)
return FALSE;
return MFDRV_MetaParam2( dev, META_FILLREGION, iRgn, iBrush );
} }
/********************************************************************** /**********************************************************************

View file

@ -597,7 +597,7 @@ BOOL MFDRV_MetaParam8(PHYSDEV dev, short func, short param1, short param2,
return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2); return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
} }
static METAFILEDRV_PDEVICE *get_metadc_ptr( HDC hdc ) METAFILEDRV_PDEVICE *get_metadc_ptr( HDC hdc )
{ {
METAFILEDRV_PDEVICE *metafile = get_gdi_client_ptr( hdc, NTGDI_OBJ_METADC ); METAFILEDRV_PDEVICE *metafile = get_gdi_client_ptr( hdc, NTGDI_OBJ_METADC );
if (!metafile) SetLastError( ERROR_INVALID_HANDLE ); if (!metafile) SetLastError( ERROR_INVALID_HANDLE );

View file

@ -59,6 +59,7 @@ extern UINT MFDRV_AddHandle( PHYSDEV dev, HGDIOBJ obj ) DECLSPEC_HIDDEN;
extern BOOL MFDRV_RemoveHandle( PHYSDEV dev, UINT index ) DECLSPEC_HIDDEN; extern BOOL MFDRV_RemoveHandle( PHYSDEV dev, UINT index ) DECLSPEC_HIDDEN;
extern INT16 MFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush ) 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_param2( HDC hdc, short func, short param1, short param2 ) 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, extern BOOL metadc_param4( HDC hdc, short func, short param1, short param2,
short param3, short param4 ) DECLSPEC_HIDDEN; short param3, short param4 ) DECLSPEC_HIDDEN;

View file

@ -89,7 +89,8 @@ BOOL CDECL nulldrv_FrameRgn( PHYSDEV dev, HRGN rgn, HBRUSH brush, INT width, INT
if (tmp) if (tmp)
{ {
if (REGION_FrameRgn( tmp, rgn, width, height )) ret = FillRgn( dev->hdc, tmp, brush ); if (REGION_FrameRgn( tmp, rgn, width, height ))
ret = NtGdiFillRgn( dev->hdc, tmp, brush );
DeleteObject( tmp ); DeleteObject( tmp );
} }
return ret; return ret;
@ -493,16 +494,14 @@ BOOL WINAPI PaintRgn( HDC hdc, HRGN hrgn )
/*********************************************************************** /***********************************************************************
* FillRgn (GDI32.@) * NtGdiFillRgn (win32u.@)
*/ */
BOOL WINAPI FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush ) BOOL WINAPI NtGdiFillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush )
{ {
PHYSDEV physdev; PHYSDEV physdev;
BOOL retval; BOOL retval;
DC * dc = get_dc_ptr( hdc ); DC * dc = get_dc_ptr( hdc );
TRACE( "%p, %p, %p\n", hdc, hrgn, hbrush );
if (!dc) return FALSE; if (!dc) return FALSE;
update_dc( dc ); update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pFillRgn ); physdev = GET_DC_PHYSDEV( dc, pFillRgn );