Piotr Caban : gdiplus: Add DrawPath stub for metafiles.
Alexandre Julliard
julliard at winehq.org
Thu Jul 13 14:41:34 CDT 2017
Module: wine
Branch: master
Commit: 8608bf532e76fc16a91b0a9bc42ba4644f24160c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8608bf532e76fc16a91b0a9bc42ba4644f24160c
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Jul 13 11:53:43 2017 +0200
gdiplus: Add DrawPath stub for metafiles.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdiplus/gdiplus_private.h | 1 +
dlls/gdiplus/graphics.c | 4 ++-
dlls/gdiplus/metafile.c | 6 ++++
dlls/gdiplus/tests/metafile.c | 69 +++++++++++++++++++++++++++++++++++++++++-
4 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index f24f38e..8c23bbb 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -111,6 +111,7 @@ extern GpStatus METAFILE_DrawImagePointsRect(GpMetafile* metafile, GpImage *imag
REAL srcheight, GpUnit srcUnit, GDIPCONST GpImageAttributes* imageAttributes,
DrawImageAbort callback, VOID *callbackData) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_AddSimpleProperty(GpMetafile *metafile, SHORT prop, SHORT val) DECLSPEC_HIDDEN;
+extern GpStatus METAFILE_DrawPath(GpMetafile *metafile, GpPen *pen, GpPath *path) DECLSPEC_HIDDEN;
extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1,
REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN;
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index a56ac43..68614f1 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -3819,7 +3819,9 @@ GpStatus WINGDIPAPI GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *path)
if (path->pathdata.Count == 0)
return Ok;
- if (!graphics->hdc || !brush_can_fill_path(pen->brush, FALSE))
+ if (graphics->image && graphics->image->type == ImageTypeMetafile)
+ retval = METAFILE_DrawPath((GpMetafile*)graphics->image, pen, path);
+ else if (!graphics->hdc || !brush_can_fill_path(pen->brush, FALSE))
retval = SOFTWARE_GdipDrawPath(graphics, pen, path);
else
retval = GDI32_GdipDrawPath(graphics, pen, path);
diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c
index df87a66..2c3be42 100644
--- a/dlls/gdiplus/metafile.c
+++ b/dlls/gdiplus/metafile.c
@@ -2569,3 +2569,9 @@ GpStatus METAFILE_AddSimpleProperty(GpMetafile *metafile, SHORT prop, SHORT val)
METAFILE_WriteRecords(metafile);
return Ok;
}
+
+GpStatus METAFILE_DrawPath(GpMetafile *metafile, GpPen *pen, GpPath *path)
+{
+ FIXME("stub\n");
+ return NotImplemented;
+}
diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c
index 2ed8355..805db91 100644
--- a/dlls/gdiplus/tests/metafile.c
+++ b/dlls/gdiplus/tests/metafile.c
@@ -939,7 +939,7 @@ static void test_emfonly(void)
stat = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
expect(Ok, stat);
stat = GdipDrawLineI(graphics, pen, 0, 0, 10, 10);
- expect(Ok, stat);
+ todo_wine expect(Ok, stat);
GdipDeletePen(pen);
stat = GdipDeleteGraphics(graphics);
@@ -2483,6 +2483,72 @@ static void test_properties(void)
expect(Ok, stat);
}
+static const emfplus_record draw_path_records[] = {
+ {0, EMR_HEADER},
+ {0, EmfPlusRecordTypeHeader},
+ {1, EmfPlusRecordTypeObject},
+ {1, EmfPlusRecordTypeObject},
+ {1, EmfPlusRecordTypeDrawPath},
+ {1, EMR_SAVEDC},
+ {1, EMR_SETICMMODE},
+ {1, EMR_BITBLT},
+ {1, EMR_RESTOREDC},
+ {0, EmfPlusRecordTypeEndOfFile},
+ {0, EMR_EOF},
+ {0}
+};
+
+static void test_drawpath(void)
+{
+ static const WCHAR description[] = {'w','i','n','e','t','e','s','t',0};
+ static const GpRectF frame = {0.0, 0.0, 100.0, 100.0};
+
+ GpMetafile *metafile;
+ GpGraphics *graphics;
+ HENHMETAFILE hemf;
+ GpStatus stat;
+ GpPath *path;
+ GpPen *pen;
+ HDC hdc;
+
+ hdc = CreateCompatibleDC(0);
+ stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitPixel, description, &metafile);
+ expect(Ok, stat);
+ DeleteDC(hdc);
+
+ stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics);
+ expect(Ok, stat);
+
+ stat = GdipCreatePath(FillModeAlternate, &path);
+ expect(Ok, stat);
+ stat = GdipAddPathLine(path, 5, 5, 30, 30);
+ expect(Ok, stat);
+
+ stat = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+ expect(Ok, stat);
+
+ stat = GdipDrawPath(graphics, pen, path);
+ todo_wine expect(Ok, stat);
+
+ stat = GdipDeletePen(pen);
+ expect(Ok, stat);
+ stat = GdipDeletePath(path);
+ expect(Ok, stat);
+
+ stat = GdipDeleteGraphics(graphics);
+ expect(Ok, stat);
+ sync_metafile(&metafile, "draw_path.emf");
+
+ stat = GdipGetHemfFromMetafile(metafile, &hemf);
+ expect(Ok, stat);
+
+ check_emfplus(hemf, draw_path_records, "draw path");
+ DeleteEnhMetaFile(hemf);
+
+ stat = GdipDisposeImage((GpImage*)metafile);
+ expect(Ok, stat);
+}
+
START_TEST(metafile)
{
struct GdiplusStartupInput gdiplusStartupInput;
@@ -2522,6 +2588,7 @@ START_TEST(metafile)
test_gditransform();
test_drawimage();
test_properties();
+ test_drawpath();
GdiplusShutdown(gdiplusToken);
}
More information about the wine-cvs
mailing list