Module: wine Branch: master Commit: 271c2bd62c6e428a5e20f9756d054a9e418ee62b URL: http://source.winehq.org/git/wine.git/?a=commit;h=271c2bd62c6e428a5e20f9756d...
Author: Vincent Povirk vincent@codeweavers.com Date: Wed Aug 3 16:19:35 2016 -0500
gdiplus: Implement metafile recording for ScaleWorldTransform.
Signed-off-by: Vincent Povirk vincent@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdiplus/gdiplus_private.h | 1 + dlls/gdiplus/graphics.c | 9 +++++++++ dlls/gdiplus/metafile.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 25ae5ee..e4056b4 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -90,6 +90,7 @@ extern GpStatus METAFILE_GraphicsClear(GpMetafile* metafile, ARGB color) DECLSPE 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_GraphicsDeleted(GpMetafile* metafile) DECLSPEC_HIDDEN;
extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1, diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 37990cf..febb60d 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -5242,6 +5242,8 @@ GpStatus WINGDIPAPI GdipEndContainer(GpGraphics *graphics, GraphicsContainer sta GpStatus WINGDIPAPI GdipScaleWorldTransform(GpGraphics *graphics, REAL sx, REAL sy, GpMatrixOrder order) { + GpStatus stat; + TRACE("(%p, %.2f, %.2f, %d)\n", graphics, sx, sy, order);
if(!graphics) @@ -5250,6 +5252,13 @@ GpStatus WINGDIPAPI GdipScaleWorldTransform(GpGraphics *graphics, REAL sx, if(graphics->busy) return ObjectBusy;
+ if (graphics->image && graphics->image->type == ImageTypeMetafile) { + stat = METAFILE_ScaleWorldTransform((GpMetafile*)graphics->image, sx, sy, order); + + if (stat != Ok) + return stat; + } + return GdipScaleMatrix(&graphics->worldtrans, sx, sy, order); }
diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index 022af38..0f03041 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -84,6 +84,13 @@ typedef struct EmfPlusRect SHORT Height; } EmfPlusRect;
+typedef struct EmfPlusScaleWorldTransform +{ + EmfPlusRecordHeader Header; + REAL Sx; + REAL Sy; +} EmfPlusScaleWorldTransform; + static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void **result) { DWORD size_needed; @@ -555,6 +562,30 @@ GpStatus METAFILE_SetPageTransform(GpMetafile* metafile, GpUnit unit, REAL scale return Ok; }
+GpStatus METAFILE_ScaleWorldTransform(GpMetafile* metafile, REAL sx, REAL sy, MatrixOrder order) +{ + if (metafile->metafile_type == MetafileTypeEmfPlusOnly || metafile->metafile_type == MetafileTypeEmfPlusDual) + { + EmfPlusScaleWorldTransform *record; + GpStatus stat; + + stat = METAFILE_AllocateRecord(metafile, + sizeof(EmfPlusScaleWorldTransform), + (void**)&record); + if (stat != Ok) + return stat; + + record->Header.Type = EmfPlusRecordTypeScaleWorldTransform; + record->Header.Flags = (order == MatrixOrderAppend ? 4 : 0); + record->Sx = sx; + record->Sy = sy; + + METAFILE_WriteRecords(metafile); + } + + return Ok; +} + GpStatus METAFILE_ReleaseDC(GpMetafile* metafile, HDC hdc) { if (hdc != metafile->record_dc)