diff --git a/dlls/gdi32/clipping.c b/dlls/gdi32/clipping.c index 7fcb719dd81..30ce88fe41c 100644 --- a/dlls/gdi32/clipping.c +++ b/dlls/gdi32/clipping.c @@ -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; } diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c index 5148e03a231..68f8e1445cb 100644 --- a/dlls/gdi32/enhmfdrv/dc.c +++ b/dlls/gdi32/enhmfdrv/dc.c @@ -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 ) diff --git a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h index 35ff9af0e90..9986d44dd85 100644 --- a/dlls/gdi32/enhmfdrv/enhmetafiledrv.h +++ b/dlls/gdi32/enhmfdrv/enhmetafiledrv.h @@ -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; diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c index 0caef2a2ec3..79a505c7701 100644 --- a/dlls/gdi32/enhmfdrv/init.c +++ b/dlls/gdi32/enhmfdrv/init.c @@ -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 */ diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index f4be6e151e1..cc7dbec910f 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -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; diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c index 7b6f1f39883..72990ef18e3 100644 --- a/dlls/gdi32/gdidc.c +++ b/dlls/gdi32/gdidc.c @@ -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.@) */ diff --git a/dlls/gdi32/mfdrv/dc.c b/dlls/gdi32/mfdrv/dc.c index 9513da7160c..93924c98216 100644 --- a/dlls/gdi32/mfdrv/dc.c +++ b/dlls/gdi32/mfdrv/dc.c @@ -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 ) diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c index f6448b19a25..4c225c68e53 100644 --- a/dlls/gdi32/mfdrv/init.c +++ b/dlls/gdi32/mfdrv/init.c @@ -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 */ diff --git a/dlls/gdi32/mfdrv/metafiledrv.h b/dlls/gdi32/mfdrv/metafiledrv.h index 9d00f4c5c69..ec3a0ab7b6d 100644 --- a/dlls/gdi32/mfdrv/metafiledrv.h +++ b/dlls/gdi32/mfdrv/metafiledrv.h @@ -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;