mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 07:44:47 +00:00
gdiplus/metafile: Implement rendering origin recording.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Esme Povirk <esme@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
42cb11b1c1
commit
2c77f717c8
|
@ -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_OffsetClip(GpMetafile *metafile, REAL dx, REAL dy) DECLSPEC_HIDDEN;
|
||||||
extern GpStatus METAFILE_ResetClip(GpMetafile *metafile) 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_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,
|
extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1,
|
||||||
REAL *y1, REAL *x2, REAL *y2) DECLSPEC_HIDDEN;
|
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 WINGDIPAPI GdipSetRenderingOrigin(GpGraphics *graphics, INT x, INT y)
|
||||||
{
|
{
|
||||||
|
GpStatus stat;
|
||||||
|
|
||||||
TRACE("(%p,%i,%i)\n", graphics, x, y);
|
TRACE("(%p,%i,%i)\n", graphics, x, y);
|
||||||
|
|
||||||
if (!graphics)
|
if (!graphics)
|
||||||
return InvalidParameter;
|
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_x = x;
|
||||||
graphics->origin_y = y;
|
graphics->origin_y = y;
|
||||||
|
|
||||||
|
|
|
@ -580,6 +580,13 @@ typedef struct EmfPlusOffsetClip
|
||||||
float dy;
|
float dy;
|
||||||
} EmfPlusOffsetClip;
|
} EmfPlusOffsetClip;
|
||||||
|
|
||||||
|
typedef struct EmfPlusSetRenderingOrigin
|
||||||
|
{
|
||||||
|
EmfPlusRecordHeader Header;
|
||||||
|
INT x;
|
||||||
|
INT y;
|
||||||
|
} EmfPlusSetRenderingOrigin;
|
||||||
|
|
||||||
static void metafile_free_object_table_entry(GpMetafile *metafile, BYTE id)
|
static void metafile_free_object_table_entry(GpMetafile *metafile, BYTE id)
|
||||||
{
|
{
|
||||||
struct emfplus_object *object = &metafile->objtable[id];
|
struct emfplus_object *object = &metafile->objtable[id];
|
||||||
|
@ -5275,3 +5282,27 @@ GpStatus METAFILE_SetClipPath(GpMetafile *metafile, GpPath *path, CombineMode mo
|
||||||
|
|
||||||
return Ok;
|
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 },
|
{ EmfPlusRecordTypeSetCompositingMode, CompositingModeSourceCopy },
|
||||||
{ EmfPlusRecordTypeSetCompositingQuality, CompositingQualityHighQuality },
|
{ EmfPlusRecordTypeSetCompositingQuality, CompositingQualityHighQuality },
|
||||||
{ EmfPlusRecordTypeSetInterpolationMode, InterpolationModeHighQualityBicubic },
|
{ EmfPlusRecordTypeSetInterpolationMode, InterpolationModeHighQualityBicubic },
|
||||||
|
{ EmfPlusRecordTypeSetRenderingOrigin },
|
||||||
|
{ EmfPlusRecordTypeSetRenderingOrigin },
|
||||||
{ EmfPlusRecordTypeEndOfFile },
|
{ EmfPlusRecordTypeEndOfFile },
|
||||||
{ EMR_EOF },
|
{ EMR_EOF },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
|
@ -2714,6 +2716,15 @@ static void test_properties(void)
|
||||||
stat = GdipSetInterpolationMode(graphics, InterpolationModeHighQuality);
|
stat = GdipSetInterpolationMode(graphics, InterpolationModeHighQuality);
|
||||||
expect(Ok, stat);
|
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);
|
stat = GdipDeleteGraphics(graphics);
|
||||||
expect(Ok, stat);
|
expect(Ok, stat);
|
||||||
sync_metafile(&metafile, "properties.emf");
|
sync_metafile(&metafile, "properties.emf");
|
||||||
|
|
Loading…
Reference in a new issue