gdiplus: Add DrawPath stub for metafiles.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5a391e18cb
commit
8608bf532e
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue