Commit 2c77f717 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdiplus/metafile: Implement rendering origin recording.

parent 42cb11b1
......@@ -120,6 +120,7 @@ extern GpStatus METAFILE_DrawArc(GpMetafile *metafile, GpPen *pen, const GpRectF
extern GpStatus METAFILE_OffsetClip(GpMetafile *metafile, REAL dx, REAL dy) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_ResetClip(GpMetafile *metafile) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_SetClipPath(GpMetafile *metafile, GpPath *path, CombineMode mode) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_SetRenderingOrigin(GpMetafile *metafile, INT x, INT y) DECLSPEC_HIDDEN;
extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1,
REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN;
......
......@@ -6250,11 +6250,23 @@ GpStatus WINGDIPAPI GdipSetPixelOffsetMode(GpGraphics *graphics, PixelOffsetMode
GpStatus WINGDIPAPI GdipSetRenderingOrigin(GpGraphics *graphics, INT x, INT y)
{
GpStatus stat;
TRACE("(%p,%i,%i)\n", graphics, x, y);
if (!graphics)
return InvalidParameter;
if (graphics->origin_x == x && graphics->origin_y == y)
return Ok;
if (is_metafile_graphics(graphics))
{
stat = METAFILE_SetRenderingOrigin((GpMetafile *)graphics->image, x, y);
if (stat != Ok)
return stat;
}
graphics->origin_x = x;
graphics->origin_y = y;
......
......@@ -580,6 +580,13 @@ typedef struct EmfPlusOffsetClip
float dy;
} EmfPlusOffsetClip;
typedef struct EmfPlusSetRenderingOrigin
{
EmfPlusRecordHeader Header;
INT x;
INT y;
} EmfPlusSetRenderingOrigin;
static void metafile_free_object_table_entry(GpMetafile *metafile, BYTE id)
{
struct emfplus_object *object = &metafile->objtable[id];
......@@ -5275,3 +5282,27 @@ GpStatus METAFILE_SetClipPath(GpMetafile *metafile, GpPath *path, CombineMode mo
return Ok;
}
GpStatus METAFILE_SetRenderingOrigin(GpMetafile *metafile, INT x, INT y)
{
EmfPlusSetRenderingOrigin *record;
GpStatus stat;
if (metafile->metafile_type == MetafileTypeEmf)
{
FIXME("stub!\n");
return NotImplemented;
}
stat = METAFILE_AllocateRecord(metafile, EmfPlusRecordTypeSetRenderingOrigin,
sizeof(*record), (void **)&record);
if (stat != Ok)
return stat;
record->x = x;
record->y = y;
METAFILE_WriteRecords(metafile);
return Ok;
}
......@@ -2661,6 +2661,8 @@ static const emfplus_record properties_records[] = {
{ EmfPlusRecordTypeSetCompositingMode, CompositingModeSourceCopy },
{ EmfPlusRecordTypeSetCompositingQuality, CompositingQualityHighQuality },
{ EmfPlusRecordTypeSetInterpolationMode, InterpolationModeHighQualityBicubic },
{ EmfPlusRecordTypeSetRenderingOrigin },
{ EmfPlusRecordTypeSetRenderingOrigin },
{ EmfPlusRecordTypeEndOfFile },
{ EMR_EOF },
{ 0 }
......@@ -2714,6 +2716,15 @@ static void test_properties(void)
stat = GdipSetInterpolationMode(graphics, InterpolationModeHighQuality);
expect(Ok, stat);
stat = GdipSetRenderingOrigin(graphics, 1, 2);
expect(Ok, stat);
stat = GdipSetRenderingOrigin(graphics, 1, 2);
expect(Ok, stat);
stat = GdipSetRenderingOrigin(graphics, 2, 1);
expect(Ok, stat);
stat = GdipDeleteGraphics(graphics);
expect(Ok, stat);
sync_metafile(&metafile, "properties.emf");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment