Commit a65718a3 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Implement ResetWorldTransform metafile playback/recording.

parent 1816698f
......@@ -91,6 +91,7 @@ extern GpStatus METAFILE_FillRectangles(GpMetafile* metafile, GpBrush* brush,
GDIPCONST GpRectF* rects, INT count) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_SetPageTransform(GpMetafile* metafile, GpUnit unit, REAL scale) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_ScaleWorldTransform(GpMetafile* metafile, REAL sx, REAL sy, MatrixOrder order) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_ResetWorldTransform(GpMetafile* metafile) DECLSPEC_HIDDEN;
extern GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile) DECLSPEC_HIDDEN;
extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1,
......
......@@ -5128,6 +5128,8 @@ GpStatus WINGDIPAPI GdipResetClip(GpGraphics *graphics)
GpStatus WINGDIPAPI GdipResetWorldTransform(GpGraphics *graphics)
{
GpStatus stat;
TRACE("(%p)\n", graphics);
if(!graphics)
......@@ -5136,6 +5138,13 @@ GpStatus WINGDIPAPI GdipResetWorldTransform(GpGraphics *graphics)
if(graphics->busy)
return ObjectBusy;
if (graphics->image && graphics->image->type == ImageTypeMetafile) {
stat = METAFILE_ResetWorldTransform((GpMetafile*)graphics->image);
if (stat != Ok)
return stat;
}
return GdipSetMatrixElements(&graphics->worldtrans, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
}
......
......@@ -586,6 +586,28 @@ GpStatus METAFILE_ScaleWorldTransform(GpMetafile* metafile, REAL sx, REAL sy, Ma
return Ok;
}
GpStatus METAFILE_ResetWorldTransform(GpMetafile* metafile)
{
if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual)
{
EmfPlusRecordHeader *record;
GpStatus stat;
stat = METAFILE_AllocateRecord(metafile,
sizeof(EmfPlusRecordHeader),
(void**)&record);
if (stat != Ok)
return stat;
record->Type = EmfPlusRecordTypeResetWorldTransform;
record->Flags = 0;
METAFILE_WriteRecords(metafile);
}
return Ok;
}
GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc)
{
if (hdc != metafile->record_dc)
......@@ -935,6 +957,12 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
return METAFILE_PlaybackUpdateWorldTransform(real_metafile);
}
case EmfPlusRecordTypeResetWorldTransform:
{
GdipSetMatrixElements(real_metafile->world_transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
return METAFILE_PlaybackUpdateWorldTransform(real_metafile);
}
default:
FIXME("Not implemented for record type %x\n", recordType);
return NotImplemented;
......
......@@ -1273,6 +1273,8 @@ static const emfplus_record worldtransform_records[] = {
{0, EmfPlusRecordTypeFillRects},
{0, EmfPlusRecordTypeScaleWorldTransform},
{0, EmfPlusRecordTypeFillRects},
{0, EmfPlusRecordTypeResetWorldTransform},
{0, EmfPlusRecordTypeFillRects},
{0, EmfPlusRecordTypeEndOfFile},
{0, EMR_EOF},
{0}
......@@ -1352,6 +1354,26 @@ static void test_worldtransform(void)
stat = GdipDeleteBrush(brush);
expect(Ok, stat);
/* reset transform */
stat = GdipResetWorldTransform(graphics);
expect(Ok, stat);
stat = GdipGetWorldTransform(graphics, transform);
expect(Ok, stat);
stat = GdipIsMatrixIdentity(transform, &identity);
expect(Ok, stat);
expect(TRUE, identity);
stat = GdipCreateSolidFill((ARGB)0xff00ffff, (GpSolidFill**)&brush);
expect(Ok, stat);
stat = GdipFillRectangle(graphics, brush, 1.0, 0.0, 1.0, 1.0);
expect(Ok, stat);
stat = GdipDeleteBrush(brush);
expect(Ok, stat);
stat = GdipDeleteMatrix(transform);
expect(Ok, stat);
......@@ -1382,6 +1404,10 @@ static void test_worldtransform(void)
expect(Ok, stat);
expect(0xff00ff00, color);
stat = GdipBitmapGetPixel(bitmap, 30, 10, &color);
expect(Ok, stat);
expect(0xff00ffff, color);
stat = GdipDeleteGraphics(graphics);
expect(Ok, stat);
......
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