diff --git a/dlls/gdi/driver.c b/dlls/gdi/driver.c index c49bf46c6af..228ccab1e70 100644 --- a/dlls/gdi/driver.c +++ b/dlls/gdi/driver.c @@ -89,6 +89,7 @@ static struct graphics_driver *create_driver( HMODULE module ) GET_FUNC(ExtDeviceMode); GET_FUNC(ExtEscape); GET_FUNC(ExtFloodFill); + GET_FUNC(ExtSelectClipRgn); GET_FUNC(ExtTextOut); GET_FUNC(FillPath); GET_FUNC(FillRgn); @@ -133,7 +134,6 @@ static struct graphics_driver *create_driver( HMODULE module ) GET_FUNC(SelectBitmap); GET_FUNC(SelectBrush); GET_FUNC(SelectClipPath); - GET_FUNC(SelectClipRgn); GET_FUNC(SelectFont); GET_FUNC(SelectPalette); GET_FUNC(SelectPen); diff --git a/dlls/gdi/enhmfdrv/dc.c b/dlls/gdi/enhmfdrv/dc.c index acf634eb484..43ca973cad4 100644 --- a/dlls/gdi/enhmfdrv/dc.c +++ b/dlls/gdi/enhmfdrv/dc.c @@ -128,6 +128,28 @@ INT EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y ) return EMFDRV_WriteRecord( dev, &emr.emr ); } +INT EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode ) +{ + EMREXTSELECTCLIPRGN *emr; + DWORD size, rgnsize; + BOOL ret; + + rgnsize = GetRegionData( hrgn, 0, NULL ); + size = rgnsize + sizeof(*emr) - 1; + emr = HeapAlloc( GetProcessHeap(), 0, size ); + + GetRegionData( hrgn, rgnsize, (RGNDATA *)&emr->RgnData ); + + emr->emr.iType = EMR_EXTSELECTCLIPRGN; + emr->emr.nSize = size; + emr->cbRgnData = rgnsize; + emr->iMode = mode; + + ret = EMFDRV_WriteRecord( dev, &emr->emr ); + HeapFree( GetProcessHeap(), 0, emr ); + return ret ? SIMPLEREGION : ERROR; +} + DWORD EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags ) { EMRSETMAPPERFLAGS emr; diff --git a/dlls/gdi/enhmfdrv/enhmetafiledrv.h b/dlls/gdi/enhmfdrv/enhmetafiledrv.h index 4ab7f6002f2..30f6df3e310 100644 --- a/dlls/gdi/enhmfdrv/enhmetafiledrv.h +++ b/dlls/gdi/enhmfdrv/enhmetafiledrv.h @@ -58,10 +58,9 @@ extern BOOL EMFDRV_CloseFigure( PHYSDEV dev ); extern BOOL EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ); extern BOOL EMFDRV_EndPath( PHYSDEV dev ); -extern INT EMFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, - INT bottom ); -extern BOOL EMFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, - COLORREF color, UINT fillType ); +extern INT EMFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ); +extern BOOL EMFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType ); +extern INT EMFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode ); extern BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCSTR str, UINT count, const INT *lpDx ); diff --git a/dlls/gdi/enhmfdrv/init.c b/dlls/gdi/enhmfdrv/init.c index c24f9101fa8..67af154b817 100644 --- a/dlls/gdi/enhmfdrv/init.c +++ b/dlls/gdi/enhmfdrv/init.c @@ -57,6 +57,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs = NULL, /* pExtDeviceMode */ NULL, /* pExtEscape */ EMFDRV_ExtFloodFill, /* pExtFloodFill */ + EMFDRV_ExtSelectClipRgn, /* pExtSelectClipRgn */ NULL, /* pExtTextOut */ EMFDRV_FillPath, /* pFillPath */ EMFDRV_FillRgn, /* pFillRgn */ @@ -101,7 +102,6 @@ static const DC_FUNCTIONS EMFDRV_Funcs = EMFDRV_SelectBitmap, /* pSelectBitmap */ EMFDRV_SelectBrush, /* pSelectBrush */ EMFDRV_SelectClipPath, /* pSelectClipPath */ - NULL, /* pSelectClipRgn */ EMFDRV_SelectFont, /* pSelectFont */ NULL, /* pSelectPalette */ EMFDRV_SelectPen, /* pSelectPen */ diff --git a/dlls/gdi/mfdrv/graphics.c b/dlls/gdi/mfdrv/graphics.c index 4c6babe4a0e..c44dbc5ecac 100644 --- a/dlls/gdi/mfdrv/graphics.c +++ b/dlls/gdi/mfdrv/graphics.c @@ -371,6 +371,25 @@ MFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT x, INT y ) } +/********************************************************************** + * MFDRV_ExtSelectClipRgn + */ +INT MFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode ) +{ + INT16 iRgn; + + if (mode != RGN_COPY) + { + FIXME( "mode %d not supported\n", mode ); + return ERROR; + } + iRgn = MFDRV_CreateRegion( dev, hrgn ); + if(iRgn == -1) + return ERROR; + return MFDRV_MetaParam1( dev, META_SELECTCLIPREGION, iRgn ) ? SIMPLEREGION : ERROR; +} + + /********************************************************************** * MFDRV_SetBkColor */ diff --git a/dlls/gdi/mfdrv/init.c b/dlls/gdi/mfdrv/init.c index 878ebc615ee..387dbeb6af3 100644 --- a/dlls/gdi/mfdrv/init.c +++ b/dlls/gdi/mfdrv/init.c @@ -58,6 +58,7 @@ static const DC_FUNCTIONS MFDRV_Funcs = NULL, /* pExtDeviceMode */ MFDRV_ExtEscape, /* pExtEscape */ MFDRV_ExtFloodFill, /* pExtFloodFill */ + MFDRV_ExtSelectClipRgn, /* pExtSelectClipRgn */ MFDRV_ExtTextOut, /* pExtTextOut */ MFDRV_FillPath, /* pFillPath */ MFDRV_FillRgn, /* pFillRgn */ @@ -102,7 +103,6 @@ static const DC_FUNCTIONS MFDRV_Funcs = MFDRV_SelectBitmap, /* pSelectBitmap */ MFDRV_SelectBrush, /* pSelectBrush */ MFDRV_SelectClipPath, /* pSelectClipPath */ - NULL, /* pSelectClipRgn */ MFDRV_SelectFont, /* pSelectFont */ NULL, /* pSelectPalette */ MFDRV_SelectPen, /* pSelectPen */ diff --git a/dlls/gdi/mfdrv/metafiledrv.h b/dlls/gdi/mfdrv/metafiledrv.h index 0d4ff74633f..f1af970b341 100644 --- a/dlls/gdi/mfdrv/metafiledrv.h +++ b/dlls/gdi/mfdrv/metafiledrv.h @@ -72,8 +72,8 @@ extern INT MFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ); extern INT MFDRV_ExtEscape( PHYSDEV dev, INT nEscape, INT cbInput, LPCVOID in_data, INT cbOutput, LPVOID out_data ); -extern BOOL MFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, - COLORREF color, UINT fillType ); +extern BOOL MFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType ); +extern INT MFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode ); extern BOOL MFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ); diff --git a/dlls/gdi/win16drv/init.c b/dlls/gdi/win16drv/init.c index 796695235f3..c9b6a0f4fca 100644 --- a/dlls/gdi/win16drv/init.c +++ b/dlls/gdi/win16drv/init.c @@ -85,6 +85,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs = WIN16DRV_ExtDeviceMode, /* pExtDeviceMode */ WIN16DRV_ExtEscape, /* pExtEscape */ NULL, /* pExtFloodFill */ + NULL, /* pExtSelectClipRgn */ WIN16DRV_ExtTextOut, /* pExtTextOut */ NULL, /* pFillPath */ NULL, /* pFillRgn */ @@ -129,7 +130,6 @@ static const DC_FUNCTIONS WIN16DRV_Funcs = WIN16DRV_SelectBitmap, /* pSelectBitmap */ WIN16DRV_SelectBrush, /* pSelectBrush */ NULL, /* pSelectClipPath */ - NULL, /* pSelectClipRgn */ WIN16DRV_SelectFont, /* pSelectFont */ NULL, /* pSelectPalette */ WIN16DRV_SelectPen, /* pSelectPen */ diff --git a/include/gdi.h b/include/gdi.h index 76b4cd82009..973c78038a1 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -167,6 +167,7 @@ typedef struct tagDC_FUNCS INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD); INT (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID); BOOL (*pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT); + INT (*pExtSelectClipRgn)(PHYSDEV,HRGN,INT); BOOL (*pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*); BOOL (*pFillPath)(PHYSDEV); BOOL (*pFillRgn)(PHYSDEV,HRGN,HBRUSH); @@ -211,7 +212,6 @@ typedef struct tagDC_FUNCS HBITMAP (*pSelectBitmap)(PHYSDEV,HBITMAP); HBRUSH (*pSelectBrush)(PHYSDEV,HBRUSH); BOOL (*pSelectClipPath)(PHYSDEV,INT); - INT (*pSelectClipRgn)(PHYSDEV,HRGN); HFONT (*pSelectFont)(PHYSDEV,HFONT); HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL); HPEN (*pSelectPen)(PHYSDEV,HPEN); diff --git a/objects/clipping.c b/objects/clipping.c index ea193910ba5..2519bcaeec4 100644 --- a/objects/clipping.c +++ b/objects/clipping.c @@ -91,6 +91,13 @@ INT WINAPI ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT fnMode ) TRACE("%04x %04x %d\n", hdc, hrgn, fnMode ); + if (dc->funcs->pExtSelectClipRgn) + { + retval = dc->funcs->pExtSelectClipRgn( dc->physDev, hrgn, fnMode ); + GDI_ReleaseObj( hdc ); + return retval; + } + if (!hrgn) { if (fnMode == RGN_COPY)