gdi32: Use NtGdiOffsetClipRgn for OffsetClipRgn 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:53 +02:00 committed by Alexandre Julliard
parent 496eaa0bc6
commit 112fe018bf
9 changed files with 34 additions and 30 deletions

View file

@ -211,18 +211,7 @@ INT CDECL nulldrv_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right,
INT CDECL nulldrv_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) INT CDECL nulldrv_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
{ {
DC *dc = get_nulldrv_dc( dev ); return ERROR;
INT ret = NULLREGION;
if (dc->hClipRgn)
{
x = MulDiv( x, dc->attr->vport_ext.cx, dc->attr->wnd_ext.cx );
y = MulDiv( y, dc->attr->vport_ext.cy, dc->attr->wnd_ext.cy );
if (dc->attr->layout & LAYOUT_RTL) x = -x;
ret = NtGdiOffsetRgn( dc->hClipRgn, x, y );
update_dc_clipping( dc );
}
return ret;
} }
@ -283,20 +272,24 @@ void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect,
/*********************************************************************** /***********************************************************************
* OffsetClipRgn (GDI32.@) * NtGdiOffsetClipRgn (win32u.@)
*/ */
INT WINAPI OffsetClipRgn( HDC hdc, INT x, INT y ) INT WINAPI NtGdiOffsetClipRgn( HDC hdc, INT x, INT y )
{ {
PHYSDEV physdev; INT ret = NULLREGION;
INT ret;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
TRACE("%p %d,%d\n", hdc, x, y );
if (!dc) return ERROR; if (!dc) return ERROR;
update_dc( dc ); update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pOffsetClipRgn );
ret = physdev->funcs->pOffsetClipRgn( physdev, x, y ); if (dc->hClipRgn)
{
x = MulDiv( x, dc->attr->vport_ext.cx, dc->attr->wnd_ext.cx );
y = MulDiv( y, dc->attr->vport_ext.cy, dc->attr->wnd_ext.cy );
if (dc->attr->layout & LAYOUT_RTL) x = -x;
ret = NtGdiOffsetRgn( dc->hClipRgn, x, y );
update_dc_clipping( dc );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;
} }

View file

@ -174,17 +174,15 @@ BOOL EMFDC_IntersectClipRect( DC_ATTR *dc_attr, INT left, INT top, INT right, IN
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr ); return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
} }
INT CDECL EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) BOOL EMFDC_OffsetClipRgn( DC_ATTR *dc_attr, INT x, INT y )
{ {
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pOffsetClipRgn );
EMROFFSETCLIPRGN emr; EMROFFSETCLIPRGN emr;
emr.emr.iType = EMR_OFFSETCLIPRGN; emr.emr.iType = EMR_OFFSETCLIPRGN;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.ptlOffset.x = x; emr.ptlOffset.x = x;
emr.ptlOffset.y = y; emr.ptlOffset.y = y;
if (!EMFDRV_WriteRecord( dev, &emr.emr )) return ERROR; return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
return next->funcs->pOffsetClipRgn( next, x, y );
} }
INT CDECL EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode ) INT CDECL EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )

View file

@ -85,7 +85,6 @@ extern BOOL CDECL EMFDRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, U
extern BOOL CDECL EMFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn ) 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_LineTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_ModifyWorldTransform( PHYSDEV dev, const XFORM *xform, DWORD mode ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_ModifyWorldTransform( PHYSDEV dev, const XFORM *xform, DWORD mode ) DECLSPEC_HIDDEN;
extern INT CDECL EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN;

View file

@ -99,7 +99,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
EMFDRV_LineTo, /* pLineTo */ EMFDRV_LineTo, /* pLineTo */
EMFDRV_ModifyWorldTransform, /* pModifyWorldTransform */ EMFDRV_ModifyWorldTransform, /* pModifyWorldTransform */
NULL, /* pMoveTo */ NULL, /* pMoveTo */
EMFDRV_OffsetClipRgn, /* pOffsetClipRgn */ NULL, /* pOffsetClipRgn */
EMFDRV_OffsetViewportOrgEx, /* pOffsetViewportOrgEx */ EMFDRV_OffsetViewportOrgEx, /* pOffsetViewportOrgEx */
EMFDRV_OffsetWindowOrgEx, /* pOffsetWindowOrgEx */ EMFDRV_OffsetWindowOrgEx, /* pOffsetWindowOrgEx */
NULL, /* pPaintRgn */ NULL, /* pPaintRgn */

View file

@ -59,6 +59,7 @@ extern BOOL METADC_IntersectClipRect( HDC hdc, INT left, INT top, INT right,
extern BOOL METADC_InvertRgn( HDC hdc, HRGN hrgn ) 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_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_OffsetClipRgn( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL METADC_PaintRgn( HDC hdc, HRGN hrgn ) DECLSPEC_HIDDEN; extern BOOL METADC_PaintRgn( HDC hdc, HRGN hrgn ) DECLSPEC_HIDDEN;
extern BOOL METADC_PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop ); extern BOOL METADC_PatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop );
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,
@ -105,6 +106,7 @@ extern BOOL EMFDC_IntersectClipRect( DC_ATTR *dc_attr, INT left, INT top, INT ri
extern BOOL EMFDC_InvertRgn( DC_ATTR *dc_attr, HRGN hrgn ) 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_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_OffsetClipRgn( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_PaintRgn( DC_ATTR *dc_attr, HRGN hrgn ) DECLSPEC_HIDDEN; extern BOOL EMFDC_PaintRgn( DC_ATTR *dc_attr, HRGN hrgn ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_PatBlt( DC_ATTR *dc_attr, INT left, INT top, INT width, INT height, DWORD rop ); extern BOOL EMFDC_PatBlt( DC_ATTR *dc_attr, INT left, INT top, INT width, INT height, DWORD rop );
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

@ -1062,6 +1062,19 @@ INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom
return NtGdiIntersectClipRect( hdc, left, top, right, bottom ); return NtGdiIntersectClipRect( hdc, left, top, right, bottom );
} }
/***********************************************************************
* OffsetClipRgn (GDI32.@)
*/
INT WINAPI OffsetClipRgn( HDC hdc, INT x, INT y )
{
DC_ATTR *dc_attr;
if (is_meta_dc( hdc )) return METADC_OffsetClipRgn( hdc, x, y );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_OffsetClipRgn( dc_attr, x, y )) return FALSE;
return NtGdiOffsetClipRgn( hdc, x, y );
}
/*********************************************************************** /***********************************************************************
* GdiSetPixelFormat (GDI32.@) * GdiSetPixelFormat (GDI32.@)
*/ */

View file

@ -80,9 +80,9 @@ INT CDECL MFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT
return MFDRV_MetaParam4( dev, META_EXCLUDECLIPRECT, left, top, right, bottom ); return MFDRV_MetaParam4( dev, META_EXCLUDECLIPRECT, left, top, right, bottom );
} }
INT CDECL MFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) BOOL METADC_OffsetClipRgn( HDC hdc, INT x, INT y )
{ {
return MFDRV_MetaParam2( dev, META_OFFSETCLIPRGN, x, y ); return metadc_param2( hdc, META_OFFSETCLIPRGN, x, y );
} }
DWORD CDECL MFDRV_SetLayout( PHYSDEV dev, DWORD layout ) DWORD CDECL MFDRV_SetLayout( PHYSDEV dev, DWORD layout )

View file

@ -164,7 +164,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pLineTo */ NULL, /* pLineTo */
NULL, /* pModifyWorldTransform */ NULL, /* pModifyWorldTransform */
NULL, /* pMoveTo */ NULL, /* pMoveTo */
MFDRV_OffsetClipRgn, /* pOffsetClipRgn */ NULL, /* pOffsetClipRgn */
MFDRV_OffsetViewportOrgEx, /* pOffsetViewportOrgEx */ MFDRV_OffsetViewportOrgEx, /* pOffsetViewportOrgEx */
MFDRV_OffsetWindowOrgEx, /* pOffsetWindowOrgEx */ MFDRV_OffsetWindowOrgEx, /* pOffsetWindowOrgEx */
NULL, /* pPaintRgn */ NULL, /* pPaintRgn */

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_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush ) 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_FlattenPath( PHYSDEV dev ) 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_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; extern BOOL CDECL MFDRV_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_PolyBezier( PHYSDEV dev, const POINT* pt, DWORD count ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_PolyBezier( PHYSDEV dev, const POINT* pt, DWORD count ) DECLSPEC_HIDDEN;