diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c index 91fde55454c0d5d8c972ee47df9651e073df8aa0..531392b4566edfd3e0a80c5d747373177657c429 100644 --- a/dlls/gdi32/enhmfdrv/dc.c +++ b/dlls/gdi32/enhmfdrv/dc.c @@ -479,13 +479,21 @@ BOOL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode ) { PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectClipPath ); EMRSELECTCLIPPATH emr; + BOOL ret = FALSE; + HRGN hrgn; emr.emr.iType = EMR_SELECTCLIPPATH; emr.emr.nSize = sizeof(emr); emr.iMode = iMode; if (!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE; - return next->funcs->pSelectClipPath( next, iMode ); + hrgn = PathToRegion( dev->hdc ); + if (hrgn) + { + ret = next->funcs->pExtSelectClipRgn( next, hrgn, iMode ); + DeleteObject( hrgn ); + } + return ret; } BOOL EMFDRV_WidenPath( PHYSDEV dev ) diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c index 514e2b4109adeb07b1ffeb18fd5cb83a09dfc6a7..eeec79c8002ecc766cd5374aed91a12df02286bc 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c @@ -2432,16 +2432,16 @@ static const unsigned char EMF_CLIPPING[] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, + 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00, - 0xd0, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x04, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, - 0x7c, 0x01, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, + 0x80, 0x07, 0x00, 0x00, 0xb0, 0x04, 0x00, 0x00, + 0xfc, 0x01, 0x00, 0x00, 0x3e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x60, 0xcc, 0x05, 0x00, - 0xe0, 0x93, 0x04, 0x00, 0x36, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x60, 0xc0, 0x07, 0x00, + 0x30, 0xda, 0x04, 0x00, 0x36, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, @@ -2451,9 +2451,16 @@ static const unsigned char EMF_CLIPPING[] = 0x64, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, - 0x00, 0x04, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 + 0x00, 0x04, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, + 0x64, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, + 0xff, 0x03, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00 }; static void translate( POINT *pt, UINT count, const XFORM *xform ) @@ -2605,6 +2612,12 @@ static void test_emf_clipping(void) ret = SelectClipRgn(hdc, hrgn); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); + BeginPath(hdc); + Rectangle(hdc, rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom); + EndPath(hdc); + ret = SelectClipPath(hdc, RGN_AND); + ok(ret, "SelectClipPath error %d\n", GetLastError()); + SetLastError(0xdeadbeef); hemf = CloseEnhMetaFile(hdc); ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());