wine-staging/patches/gdiplus-GdipCreateMetafileFromStream/0002-gdiplus-Implement-GdipGetMetafileHeaderFromMetafile.patch

103 lines
3.7 KiB
Diff

From 38a7a77a067d4610666ca453f4ca68a69117e80e Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 10 May 2016 12:44:49 +0800
Subject: gdiplus: Implement GdipGetMetafileHeaderFromMetafile.
For bug #27415.
These patches depend on
"gdiplus: Reimplement metafile loading using gdi32 instead of IPicture. (v2)"
---
dlls/gdiplus/metafile.c | 15 +++++++++++----
dlls/gdiplus/tests/image.c | 24 ++++++++++++------------
2 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c
index 7af6c8c..30b2122 100644
--- a/dlls/gdiplus/metafile.c
+++ b/dlls/gdiplus/metafile.c
@@ -957,17 +957,24 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileDestPointI(GpGraphics *graphics,
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile(GpMetafile * metafile,
MetafileHeader * header)
{
- static int calls;
+ GpStatus status;
TRACE("(%p, %p)\n", metafile, header);
if(!metafile || !header)
return InvalidParameter;
- if(!(calls++))
- FIXME("not implemented\n");
+ if (!metafile->hemf)
+ return InvalidParameter;
- memset(header, 0, sizeof(MetafileHeader));
+ status = GdipGetMetafileHeaderFromEmf(metafile->hemf, header);
+ if (status != Ok) return status;
+
+ header->Type = metafile->metafile_type;
+ header->DpiX = metafile->image.xres;
+ header->DpiY = metafile->image.yres;
+ header->Width = metafile->bounds.Width;
+ header->Height = metafile->bounds.Height;
return Ok;
}
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index e6de9db..a28ddb4 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -1465,17 +1465,17 @@ static void test_loadwmf(void)
expect(Ok, stat);
if (stat == Ok)
{
- todo_wine expect(MetafileTypeWmfPlaceable, header.Type);
+ expect(MetafileTypeWmfPlaceable, header.Type);
todo_wine expect(sizeof(wmfimage)-sizeof(WmfPlaceableFileHeader), header.Size);
todo_wine expect(0x300, header.Version);
expect(0, header.EmfPlusFlags);
- todo_wine expectf(1440.0, header.DpiX);
- todo_wine expectf(1440.0, header.DpiY);
+ expectf(1440.0, header.DpiX);
+ expectf(1440.0, header.DpiY);
expect(0, header.X);
expect(0, header.Y);
- todo_wine expect(320, header.Width);
- todo_wine expect(320, header.Height);
- todo_wine expect(1, U(header).WmfHeader.mtType);
+ expect(320, header.Width);
+ expect(320, header.Height);
+ expect(1, U(header).WmfHeader.mtType);
expect(0, header.EmfPlusHeaderSize);
expect(0, header.LogicalDpiX);
expect(0, header.LogicalDpiY);
@@ -1523,17 +1523,17 @@ static void test_createfromwmf(void)
expect(Ok, stat);
if (stat == Ok)
{
- todo_wine expect(MetafileTypeWmfPlaceable, header.Type);
+ expect(MetafileTypeWmfPlaceable, header.Type);
todo_wine expect(sizeof(wmfimage)-sizeof(WmfPlaceableFileHeader), header.Size);
todo_wine expect(0x300, header.Version);
expect(0, header.EmfPlusFlags);
- todo_wine expectf(1440.0, header.DpiX);
- todo_wine expectf(1440.0, header.DpiY);
+ expectf(1440.0, header.DpiX);
+ expectf(1440.0, header.DpiY);
expect(0, header.X);
expect(0, header.Y);
- todo_wine expect(320, header.Width);
- todo_wine expect(320, header.Height);
- todo_wine expect(1, U(header).WmfHeader.mtType);
+ expect(320, header.Width);
+ expect(320, header.Height);
+ expect(1, U(header).WmfHeader.mtType);
expect(0, header.EmfPlusHeaderSize);
expect(0, header.LogicalDpiX);
expect(0, header.LogicalDpiY);
--
2.8.0