Commit 24a22a51 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiExtSelectClipRgn for ExtSelectClipRgn implementation.

parent 18a0b582
...@@ -143,8 +143,19 @@ static inline void create_default_clip_region( DC * dc ) ...@@ -143,8 +143,19 @@ static inline void create_default_clip_region( DC * dc )
INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode ) INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode )
{ {
DC *dc = get_nulldrv_dc( dev ); return ERROR;
INT ret; }
/******************************************************************************
* NtGdiExtSelectClipRgn (win32u.@)
*/
INT WINAPI NtGdiExtSelectClipRgn( HDC hdc, HRGN rgn, INT mode )
{
INT ret = ERROR;
DC *dc;
if (!(dc = get_dc_ptr( hdc ))) return ERROR;
update_dc( dc );
if (!rgn) if (!rgn)
{ {
...@@ -157,11 +168,11 @@ INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode ) ...@@ -157,11 +168,11 @@ INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode )
break; break;
case RGN_DIFF: case RGN_DIFF:
return ERROR; break;
default: default:
FIXME("Unimplemented: hrgn NULL in mode: %d\n", mode); FIXME("Unimplemented: hrgn NULL in mode: %d\n", mode);
return ERROR; break;
} }
} }
else else
...@@ -170,7 +181,11 @@ INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode ) ...@@ -170,7 +181,11 @@ INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode )
if (dc->attr->layout & LAYOUT_RTL) if (dc->attr->layout & LAYOUT_RTL)
{ {
if (!(mirrored = NtGdiCreateRectRgn( 0, 0, 0, 0 ))) return ERROR; if (!(mirrored = NtGdiCreateRectRgn( 0, 0, 0, 0 )))
{
release_dc_ptr( dc );
return ERROR;
}
mirror_region( mirrored, rgn, dc->attr->vis_rect.right - dc->attr->vis_rect.left ); mirror_region( mirrored, rgn, dc->attr->vis_rect.right - dc->attr->vis_rect.left );
rgn = mirrored; rgn = mirrored;
} }
...@@ -185,7 +200,8 @@ INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode ) ...@@ -185,7 +200,8 @@ INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode )
if (mirrored) DeleteObject( mirrored ); if (mirrored) DeleteObject( mirrored );
} }
update_dc_clipping( dc ); if (ret != ERROR) update_dc_clipping( dc );
release_dc_ptr( dc );
return ret; return ret;
} }
...@@ -204,35 +220,6 @@ INT CDECL nulldrv_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) ...@@ -204,35 +220,6 @@ INT CDECL nulldrv_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
return ERROR; return ERROR;
} }
/***********************************************************************
* SelectClipRgn (GDI32.@)
*/
INT WINAPI SelectClipRgn( HDC hdc, HRGN hrgn )
{
return ExtSelectClipRgn( hdc, hrgn, RGN_COPY );
}
/******************************************************************************
* ExtSelectClipRgn [GDI32.@]
*/
INT WINAPI ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT fnMode )
{
PHYSDEV physdev;
INT retval;
DC * dc = get_dc_ptr( hdc );
TRACE("%p %p %d\n", hdc, hrgn, fnMode );
if (!dc) return ERROR;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pExtSelectClipRgn );
retval = physdev->funcs->pExtSelectClipRgn( physdev, hrgn, fnMode );
release_dc_ptr( dc );
return retval;
}
/*********************************************************************** /***********************************************************************
* __wine_set_visible_region (GDI32.@) * __wine_set_visible_region (GDI32.@)
*/ */
......
...@@ -183,9 +183,8 @@ BOOL EMFDC_OffsetClipRgn( DC_ATTR *dc_attr, INT x, INT y ) ...@@ -183,9 +183,8 @@ BOOL EMFDC_OffsetClipRgn( DC_ATTR *dc_attr, INT x, INT y )
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr ); return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
} }
INT CDECL EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode ) BOOL EMFDC_ExtSelectClipRgn( DC_ATTR *dc_attr, HRGN hrgn, INT mode )
{ {
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pExtSelectClipRgn );
EMREXTSELECTCLIPRGN *emr; EMREXTSELECTCLIPRGN *emr;
DWORD size, rgnsize; DWORD size, rgnsize;
BOOL ret; BOOL ret;
...@@ -206,9 +205,9 @@ INT CDECL EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode ) ...@@ -206,9 +205,9 @@ INT CDECL EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
emr->cbRgnData = rgnsize; emr->cbRgnData = rgnsize;
emr->iMode = mode; emr->iMode = mode;
ret = EMFDRV_WriteRecord( dev, &emr->emr ); ret = EMFDRV_WriteRecord( dc_attr->emf, &emr->emr );
HeapFree( GetProcessHeap(), 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret ? next->funcs->pExtSelectClipRgn( next, hrgn, mode ) : ERROR; return ret;
} }
INT CDECL EMFDRV_SetMapMode( PHYSDEV dev, INT mode ) INT CDECL EMFDRV_SetMapMode( PHYSDEV dev, INT mode )
...@@ -522,7 +521,6 @@ BOOL CDECL EMFDRV_FlattenPath( PHYSDEV dev ) ...@@ -522,7 +521,6 @@ BOOL CDECL EMFDRV_FlattenPath( PHYSDEV dev )
BOOL CDECL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode ) BOOL CDECL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode )
{ {
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectClipPath );
EMRSELECTCLIPPATH emr; EMRSELECTCLIPPATH emr;
BOOL ret = FALSE; BOOL ret = FALSE;
HRGN hrgn; HRGN hrgn;
...@@ -535,7 +533,7 @@ BOOL CDECL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode ) ...@@ -535,7 +533,7 @@ BOOL CDECL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode )
hrgn = PathToRegion( dev->hdc ); hrgn = PathToRegion( dev->hdc );
if (hrgn) if (hrgn)
{ {
ret = next->funcs->pExtSelectClipRgn( next, hrgn, iMode ); ret = NtGdiExtSelectClipRgn( dev->hdc, hrgn, iMode );
DeleteObject( hrgn ); DeleteObject( hrgn );
} }
return ret; return ret;
......
...@@ -70,7 +70,6 @@ extern BOOL CDECL EMFDRV_Chord( PHYSDEV dev, INT left, INT top, INT right, I ...@@ -70,7 +70,6 @@ extern BOOL CDECL EMFDRV_Chord( PHYSDEV dev, INT left, INT top, INT right, I
INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_DeleteObject( PHYSDEV dev, HGDIOBJ obj ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_DeleteObject( PHYSDEV dev, HGDIOBJ obj ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern INT CDECL EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, extern BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str,
UINT count, const INT *lpDx ) DECLSPEC_HIDDEN; UINT count, const INT *lpDx ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL CDECL EMFDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
......
...@@ -61,7 +61,7 @@ static const struct gdi_dc_funcs emfdrv_driver = ...@@ -61,7 +61,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
NULL, /* pExtDeviceMode */ NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */ NULL, /* pExtEscape */
NULL, /* pExtFloodFill */ NULL, /* pExtFloodFill */
EMFDRV_ExtSelectClipRgn, /* pExtSelectClipRgn */ NULL, /* pExtSelectClipRgn */
EMFDRV_ExtTextOut, /* pExtTextOut */ EMFDRV_ExtTextOut, /* pExtTextOut */
EMFDRV_FillPath, /* pFillPath */ EMFDRV_FillPath, /* pFillPath */
EMFDRV_FillRgn, /* pFillRgn */ EMFDRV_FillRgn, /* pFillRgn */
......
...@@ -51,6 +51,7 @@ extern BOOL METADC_ExcludeClipRect( HDC hdc, INT left, INT top, INT right, ...@@ -51,6 +51,7 @@ extern BOOL METADC_ExcludeClipRect( HDC hdc, INT left, INT top, INT right,
INT bottom ) DECLSPEC_HIDDEN; INT bottom ) DECLSPEC_HIDDEN;
extern BOOL METADC_ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color, extern BOOL METADC_ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color,
UINT fill_type ) DECLSPEC_HIDDEN; UINT fill_type ) DECLSPEC_HIDDEN;
extern BOOL METADC_ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT mode ) 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_FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush ) DECLSPEC_HIDDEN;
...@@ -98,6 +99,7 @@ extern BOOL EMFDC_ExcludeClipRect( DC_ATTR *dc_attr, INT left, INT top, INT righ ...@@ -98,6 +99,7 @@ extern BOOL EMFDC_ExcludeClipRect( DC_ATTR *dc_attr, INT left, INT top, INT righ
INT bottom ) DECLSPEC_HIDDEN; INT bottom ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_ExtFloodFill( DC_ATTR *dc_attr, INT x, INT y, COLORREF color, extern BOOL EMFDC_ExtFloodFill( DC_ATTR *dc_attr, INT x, INT y, COLORREF color,
UINT fill_type ) DECLSPEC_HIDDEN; UINT fill_type ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_ExtSelectClipRgn( DC_ATTR *dc_attr, HRGN hrgn, INT mode ) 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_FillRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush ) DECLSPEC_HIDDEN;
......
...@@ -1089,6 +1089,30 @@ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top, INT right, INT bottom ) ...@@ -1089,6 +1089,30 @@ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top, INT right, INT bottom )
return NtGdiExcludeClipRect( hdc, left, top, right, bottom ); return NtGdiExcludeClipRect( hdc, left, top, right, bottom );
} }
/******************************************************************************
* ExtSelectClipRgn (GDI32.@)
*/
INT WINAPI ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT mode )
{
DC_ATTR *dc_attr;
TRACE("%p %p %d\n", hdc, hrgn, mode );
if (is_meta_dc( hdc )) return METADC_ExtSelectClipRgn( hdc, hrgn, mode );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_ExtSelectClipRgn( dc_attr, hrgn, mode ))
return FALSE;
return NtGdiExtSelectClipRgn( hdc, hrgn, mode );
}
/***********************************************************************
* SelectClipRgn (GDI32.@)
*/
INT WINAPI SelectClipRgn( HDC hdc, HRGN hrgn )
{
return ExtSelectClipRgn( hdc, hrgn, RGN_COPY );
}
/*********************************************************************** /***********************************************************************
* GdiSetPixelFormat (GDI32.@) * GdiSetPixelFormat (GDI32.@)
*/ */
......
...@@ -429,20 +429,22 @@ BOOL METADC_FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, INT x, INT y ) ...@@ -429,20 +429,22 @@ BOOL METADC_FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, INT x, INT y )
/********************************************************************** /**********************************************************************
* MFDRV_ExtSelectClipRgn * METADC_ExtSelectClipRgn
*/ */
INT CDECL MFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode ) BOOL METADC_ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT mode )
{ {
METAFILEDRV_PDEVICE *metadc;
INT16 iRgn; INT16 iRgn;
INT ret; INT ret;
if (!(metadc = get_metadc_ptr( hdc ))) return FALSE;
if (mode != RGN_COPY) return ERROR; if (mode != RGN_COPY) return ERROR;
if (!hrgn) return NULLREGION; if (!hrgn) return NULLREGION;
iRgn = MFDRV_CreateRegion( dev, hrgn ); iRgn = MFDRV_CreateRegion( &metadc->dev, hrgn );
if(iRgn == -1) return ERROR; if(iRgn == -1) return ERROR;
ret = MFDRV_MetaParam1( dev, META_SELECTOBJECT, iRgn ) ? NULLREGION : ERROR; ret = MFDRV_MetaParam1( &metadc->dev, META_SELECTOBJECT, iRgn ) ? NULLREGION : ERROR;
MFDRV_MetaParam1( dev, META_DELETEOBJECT, iRgn ); MFDRV_MetaParam1( &metadc->dev, META_DELETEOBJECT, iRgn );
MFDRV_RemoveHandle( dev, iRgn ); MFDRV_RemoveHandle( &metadc->dev, iRgn );
return ret; return ret;
} }
......
...@@ -126,7 +126,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs = ...@@ -126,7 +126,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pExtDeviceMode */ NULL, /* pExtDeviceMode */
MFDRV_ExtEscape, /* pExtEscape */ MFDRV_ExtEscape, /* pExtEscape */
NULL, /* pExtFloodFill */ NULL, /* pExtFloodFill */
MFDRV_ExtSelectClipRgn, /* pExtSelectClipRgn */ NULL, /* pExtSelectClipRgn */
NULL, /* pExtTextOut */ NULL, /* pExtTextOut */
MFDRV_FillPath, /* pFillPath */ MFDRV_FillPath, /* pFillPath */
MFDRV_FillRgn, /* pFillRgn */ MFDRV_FillRgn, /* pFillRgn */
......
...@@ -83,7 +83,6 @@ extern BOOL CDECL MFDRV_BeginPath( PHYSDEV dev ) DECLSPEC_HIDDEN; ...@@ -83,7 +83,6 @@ extern BOOL CDECL MFDRV_BeginPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_CloseFigure( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_CloseFigure( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_DeleteObject( PHYSDEV dev, HGDIOBJ obj ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_DeleteObject( PHYSDEV dev, HGDIOBJ obj ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_EndPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_EndPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode ) DECLSPEC_HIDDEN;
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment