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 )
INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode )
{
DC *dc = get_nulldrv_dc( dev );
INT ret;
return ERROR;
}
/******************************************************************************
* 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)
{
......@@ -157,11 +168,11 @@ INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode )
break;
case RGN_DIFF:
return ERROR;
break;
default:
FIXME("Unimplemented: hrgn NULL in mode: %d\n", mode);
return ERROR;
break;
}
}
else
......@@ -170,7 +181,11 @@ INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode )
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 );
rgn = mirrored;
}
......@@ -185,7 +200,8 @@ INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode )
if (mirrored) DeleteObject( mirrored );
}
update_dc_clipping( dc );
if (ret != ERROR) update_dc_clipping( dc );
release_dc_ptr( dc );
return ret;
}
......@@ -204,35 +220,6 @@ INT CDECL nulldrv_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
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.@)
*/
......
......@@ -183,9 +183,8 @@ BOOL EMFDC_OffsetClipRgn( DC_ATTR *dc_attr, INT x, INT y )
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;
DWORD size, rgnsize;
BOOL ret;
......@@ -206,9 +205,9 @@ INT CDECL EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
emr->cbRgnData = rgnsize;
emr->iMode = mode;
ret = EMFDRV_WriteRecord( dev, &emr->emr );
ret = EMFDRV_WriteRecord( dc_attr->emf, &emr->emr );
HeapFree( GetProcessHeap(), 0, emr );
return ret ? next->funcs->pExtSelectClipRgn( next, hrgn, mode ) : ERROR;
return ret;
}
INT CDECL EMFDRV_SetMapMode( PHYSDEV dev, INT mode )
......@@ -522,7 +521,6 @@ BOOL CDECL EMFDRV_FlattenPath( PHYSDEV dev )
BOOL CDECL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode )
{
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectClipPath );
EMRSELECTCLIPPATH emr;
BOOL ret = FALSE;
HRGN hrgn;
......@@ -535,7 +533,7 @@ BOOL CDECL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode )
hrgn = PathToRegion( dev->hdc );
if (hrgn)
{
ret = next->funcs->pExtSelectClipRgn( next, hrgn, iMode );
ret = NtGdiExtSelectClipRgn( dev->hdc, hrgn, iMode );
DeleteObject( hrgn );
}
return ret;
......
......@@ -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;
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 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,
UINT count, const INT *lpDx ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
......
......@@ -61,7 +61,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */
NULL, /* pExtFloodFill */
EMFDRV_ExtSelectClipRgn, /* pExtSelectClipRgn */
NULL, /* pExtSelectClipRgn */
EMFDRV_ExtTextOut, /* pExtTextOut */
EMFDRV_FillPath, /* pFillPath */
EMFDRV_FillRgn, /* pFillRgn */
......
......@@ -51,6 +51,7 @@ extern BOOL METADC_ExcludeClipRect( HDC hdc, INT left, INT top, INT right,
INT bottom ) DECLSPEC_HIDDEN;
extern BOOL METADC_ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color,
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,
const WCHAR *str, UINT count, const INT *dx ) 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
INT bottom ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_ExtFloodFill( DC_ATTR *dc_attr, INT x, INT y, COLORREF color,
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,
const WCHAR *str, UINT count, const INT *dx ) 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 )
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.@)
*/
......
......@@ -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;
INT ret;
if (!(metadc = get_metadc_ptr( hdc ))) return FALSE;
if (mode != RGN_COPY) return ERROR;
if (!hrgn) return NULLREGION;
iRgn = MFDRV_CreateRegion( dev, hrgn );
iRgn = MFDRV_CreateRegion( &metadc->dev, hrgn );
if(iRgn == -1) return ERROR;
ret = MFDRV_MetaParam1( dev, META_SELECTOBJECT, iRgn ) ? NULLREGION : ERROR;
MFDRV_MetaParam1( dev, META_DELETEOBJECT, iRgn );
MFDRV_RemoveHandle( dev, iRgn );
ret = MFDRV_MetaParam1( &metadc->dev, META_SELECTOBJECT, iRgn ) ? NULLREGION : ERROR;
MFDRV_MetaParam1( &metadc->dev, META_DELETEOBJECT, iRgn );
MFDRV_RemoveHandle( &metadc->dev, iRgn );
return ret;
}
......
......@@ -126,7 +126,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pExtDeviceMode */
MFDRV_ExtEscape, /* pExtEscape */
NULL, /* pExtFloodFill */
MFDRV_ExtSelectClipRgn, /* pExtSelectClipRgn */
NULL, /* pExtSelectClipRgn */
NULL, /* pExtTextOut */
MFDRV_FillPath, /* pFillPath */
MFDRV_FillRgn, /* pFillRgn */
......
......@@ -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_DeleteObject( PHYSDEV dev, HGDIOBJ obj ) 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_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush ) 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