Piotr Caban : gdi32: Don' t write EMR_EXTSELECTCLIPRGN to emf file on SelectClipPath call.
Alexandre Julliard
julliard at winehq.org
Thu Jun 22 16:50:51 CDT 2017
Module: wine
Branch: master
Commit: f629e9797dae61fd60ce3a727477caa02fdee22b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f629e9797dae61fd60ce3a727477caa02fdee22b
Author: Piotr Caban <piotr at codeweavers.com>
Date: Wed Jun 21 10:34:17 2017 +0200
gdi32: Don't write EMR_EXTSELECTCLIPRGN to emf file on SelectClipPath call.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/enhmfdrv/dc.c | 10 +++++++++-
dlls/gdi32/tests/metafile.c | 31 ++++++++++++++++++++++---------
2 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c
index 91fde55..531392b 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 514e2b4..eeec79c 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());
More information about the wine-cvs
mailing list