gdi32: Use NtGdiIntersectClipRect for IntersectClipRect 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-08-04 11:20:21 +02:00 committed by Alexandre Julliard
parent b1b49b5863
commit 496eaa0bc6
9 changed files with 47 additions and 38 deletions

View file

@ -206,24 +206,7 @@ INT CDECL nulldrv_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, IN
INT CDECL nulldrv_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
{
DC *dc = get_nulldrv_dc( dev );
RECT rect = get_clip_rect( dc, left, top, right, bottom );
INT ret;
HRGN rgn;
if (!dc->hClipRgn)
{
dc->hClipRgn = CreateRectRgnIndirect( &rect );
ret = SIMPLEREGION;
}
else
{
if (!(rgn = CreateRectRgnIndirect( &rect ))) return ERROR;
ret = NtGdiCombineRgn( dc->hClipRgn, dc->hClipRgn, rgn, RGN_AND );
DeleteObject( rgn );
}
if (ret != ERROR) update_dc_clipping( dc );
return ret;
return ERROR;
}
INT CDECL nulldrv_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
@ -341,20 +324,30 @@ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top,
/***********************************************************************
* IntersectClipRect (GDI32.@)
* NtGdiIntersectClipRect (win32u.@)
*/
INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom )
INT WINAPI NtGdiIntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom )
{
PHYSDEV physdev;
INT ret;
DC *dc = get_dc_ptr( hdc );
INT ret = ERROR;
RECT rect;
HRGN rgn;
DC *dc;
TRACE("%p %d,%d - %d,%d\n", hdc, left, top, right, bottom );
if (!dc) return ERROR;
if (!(dc = get_dc_ptr( hdc ))) return ERROR;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pIntersectClipRect );
ret = physdev->funcs->pIntersectClipRect( physdev, left, top, right, bottom );
rect = get_clip_rect( dc, left, top, right, bottom );
if (!dc->hClipRgn)
{
if ((dc->hClipRgn = CreateRectRgnIndirect( &rect )))
ret = SIMPLEREGION;
}
else if ((rgn = CreateRectRgnIndirect( &rect )))
{
ret = NtGdiCombineRgn( dc->hClipRgn, dc->hClipRgn, rgn, RGN_AND );
DeleteObject( rgn );
}
if (ret != ERROR) update_dc_clipping( dc );
release_dc_ptr( dc );
return ret;
}

View file

@ -161,9 +161,8 @@ INT CDECL EMFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT
return next->funcs->pExcludeClipRect( next, left, top, right, bottom );
}
INT CDECL EMFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom)
BOOL EMFDC_IntersectClipRect( DC_ATTR *dc_attr, INT left, INT top, INT right, INT bottom)
{
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pIntersectClipRect );
EMRINTERSECTCLIPRECT emr;
emr.emr.iType = EMR_INTERSECTCLIPRECT;
@ -172,8 +171,7 @@ INT CDECL EMFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, I
emr.rclClip.top = top;
emr.rclClip.right = right;
emr.rclClip.bottom = bottom;
if (!EMFDRV_WriteRecord( dev, &emr.emr )) return ERROR;
return next->funcs->pIntersectClipRect( next, left, top, right, bottom );
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
INT CDECL EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y )

View file

@ -82,7 +82,6 @@ extern BOOL CDECL EMFDRV_GdiComment( PHYSDEV dev, UINT bytes, const BYTE *bu
extern INT CDECL EMFDRV_GetDeviceCaps( PHYSDEV dev, INT cap ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
void *grad_array, ULONG ngrad, ULONG mode ) DECLSPEC_HIDDEN;
extern INT CDECL EMFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_LineTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_ModifyWorldTransform( PHYSDEV dev, const XFORM *xform, DWORD mode ) DECLSPEC_HIDDEN;

View file

@ -94,7 +94,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
NULL, /* pGetTextFace */
NULL, /* pGetTextMetrics */
EMFDRV_GradientFill, /* pGradientFill */
EMFDRV_IntersectClipRect, /* pIntersectClipRect */
NULL, /* pIntersectClipRect */
EMFDRV_InvertRgn, /* pInvertRgn */
EMFDRV_LineTo, /* pLineTo */
EMFDRV_ModifyWorldTransform, /* pModifyWorldTransform */

View file

@ -54,6 +54,8 @@ extern BOOL METADC_ExtTextOut( HDC hdc, INT x, INT y, UINT flags, const RECT *re
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 INT METADC_GetDeviceCaps( HDC hdc, INT cap );
extern BOOL METADC_IntersectClipRect( HDC hdc, INT left, INT top, INT right,
INT bottom ) 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;
@ -98,6 +100,8 @@ extern BOOL EMFDC_FrameRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush, INT widt
INT height ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_GradientFill( DC_ATTR *dc_attr, TRIVERTEX *vert_array, ULONG nvert,
void *grad_array, ULONG ngrad, ULONG mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_IntersectClipRect( DC_ATTR *dc_attr, INT left, INT top, INT right,
INT bottom ) 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;

View file

@ -1046,6 +1046,22 @@ BOOL WINAPI CloseFigure( HDC hdc )
return NtGdiCloseFigure( hdc );
}
/***********************************************************************
* IntersectClipRect (GDI32.@)
*/
INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom )
{
DC_ATTR *dc_attr;
TRACE("%p %d,%d - %d,%d\n", hdc, left, top, right, bottom );
if (is_meta_dc( hdc )) return METADC_IntersectClipRect( hdc, left, top, right, bottom );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_IntersectClipRect( dc_attr, left, top, right, bottom ))
return FALSE;
return NtGdiIntersectClipRect( hdc, left, top, right, bottom );
}
/***********************************************************************
* GdiSetPixelFormat (GDI32.@)
*/

View file

@ -70,9 +70,9 @@ BOOL METADC_SetStretchBltMode( HDC hdc, INT mode )
return metadc_param1( hdc, META_SETSTRETCHBLTMODE, mode );
}
INT CDECL MFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
BOOL METADC_IntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom )
{
return MFDRV_MetaParam4( dev, META_INTERSECTCLIPRECT, left, top, right, bottom );
return metadc_param4( hdc, META_INTERSECTCLIPRECT, left, top, right, bottom );
}
INT CDECL MFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )

View file

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

View file

@ -88,7 +88,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 INT CDECL MFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) 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;