[PATCH] gdi32: Support Begin/End Path for metafile DCs
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Tue Feb 16 01:14:00 CST 2016
Based off Dmitry Timoshkov patch.
Fixes https://bugs.winehq.org/show_bug.cgi?id=39185
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
dlls/gdi32/enhmfdrv/dc.c | 4 +++-
dlls/gdi32/path.c | 12 +++++++++++-
dlls/gdi32/tests/metafile.c | 25 ++++++++++++++++++++++++-
3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/dlls/gdi32/enhmfdrv/dc.c b/dlls/gdi32/enhmfdrv/dc.c
index cbf3f5c..a92cf4d 100644
--- a/dlls/gdi32/enhmfdrv/dc.c
+++ b/dlls/gdi32/enhmfdrv/dc.c
@@ -420,12 +420,14 @@ BOOL EMFDRV_AbortPath( PHYSDEV dev )
BOOL EMFDRV_BeginPath( PHYSDEV dev )
{
+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pBeginPath );
EMRBEGINPATH emr;
emr.emr.iType = EMR_BEGINPATH;
emr.emr.nSize = sizeof(emr);
- return EMFDRV_WriteRecord( dev, &emr.emr );
+ if (!EMFDRV_WriteRecord( dev, &emr.emr )) return FALSE;
+ return next->funcs->pBeginPath( next );
}
BOOL EMFDRV_CloseFigure( PHYSDEV dev )
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index e09cd0b..78c2f1d 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -804,13 +804,23 @@ static BOOL pathdrv_EndPath( PHYSDEV dev )
{
struct path_physdev *physdev = get_path_physdev( dev );
DC *dc = get_dc_ptr( dev->hdc );
+ BOOL ret = TRUE;
+ DWORD type;
if (!dc) return FALSE;
+
+ type = GetObjectType( dev->hdc );
+ if (type == OBJ_METADC || type == OBJ_ENHMETADC)
+ {
+ PHYSDEV next = GET_NEXT_PHYSDEV( dev, pEndPath );
+ ret = next->funcs->pEndPath( next );
+ }
+
dc->path = physdev->path;
pop_dc_driver( dc, &path_driver );
HeapFree( GetProcessHeap(), 0, physdev );
release_dc_ptr( dc );
- return TRUE;
+ return ret;
}
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index 6804a96..cea6cef 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -3367,6 +3367,8 @@ static void test_emf_GetPath(void)
HENHMETAFILE hemf;
BOOL ret;
int size;
+ POINT *points;
+ BYTE *types;
SetLastError(0xdeadbeef);
hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
@@ -3386,7 +3388,28 @@ static void test_emf_GetPath(void)
EndPath(hdcMetafile);
size = GetPath(hdcMetafile, NULL, NULL, 0);
- todo_wine ok( size == 5, "GetPath returned %d.\n", size);
+ ok( size == 5, "GetPath returned %d.\n", size);
+ if(size == 5)
+ {
+ points = HeapAlloc(GetProcessHeap(), 0, size * sizeof(POINT));
+ types = HeapAlloc(GetProcessHeap(), 0, size );
+
+ GetPath(hdcMetafile, points, types, size);
+
+ ok(types[0] == PT_MOVETO, "unexpected value %d\n", types[0]);
+ ok(points[0].x == 50 && points[0].y == 50, "unexpected point (%d,%d)\n", points[0].x, points[0].y);
+ ok(types[1] == PT_LINETO, "unexpected value %d\n", types[1]);
+ ok(points[1].x == 50 && points[1].y == 150, "unexpected point (%d,%d)\n", points[1].x, points[1].y);
+ ok(types[2] == PT_LINETO, "unexpected value %d\n", types[2]);
+ ok(points[2].x == 150 && points[2].y == 150, "unexpected point (%d,%d)\n", points[2].x, points[2].y);
+ ok(types[3] == PT_LINETO, "unexpected value %d\n", types[3]);
+ ok(points[3].x == 150 && points[3].y == 50, "unexpected point (%d,%d)\n", points[3].x, points[3].y);
+ ok(types[4] == PT_LINETO, "unexpected value %d\n", types[4]);
+ ok(points[4].x == 50 && points[4].y == 50, "unexpected point (%d,%d)\n", points[4].x, points[4].y);
+
+ HeapFree(GetProcessHeap(), 0, points);
+ HeapFree(GetProcessHeap(), 0, types);
+ }
hemf = CloseEnhMetaFile(hdcMetafile);
ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
--
1.9.1
More information about the wine-patches
mailing list