Added patch to implement gdiplus.GdipGetMetafileHeaderFromMetafile and other metafile functions.

This commit is contained in:
Sebastian Lackner 2016-05-13 08:29:00 +02:00
parent 00902fdb2f
commit b1d1f3475b
6 changed files with 288 additions and 19 deletions

View File

@ -0,0 +1,102 @@
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

View File

@ -0,0 +1,54 @@
From 109c9e762ab80fcddb5dc489907fe585d81dec89 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 10 May 2016 12:56:24 +0800
Subject: gdiplus: Implement GdipGetMetafileHeaderFromWmf.
---
dlls/gdiplus/gdiplus.spec | 2 +-
dlls/gdiplus/metafile.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 9f7ce5f..893796e 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -303,7 +303,7 @@
303 stdcall GdipGetMetafileHeaderFromFile(wstr ptr)
304 stdcall GdipGetMetafileHeaderFromMetafile(ptr ptr)
305 stdcall GdipGetMetafileHeaderFromStream(ptr ptr)
-306 stub GdipGetMetafileHeaderFromWmf
+306 stdcall GdipGetMetafileHeaderFromWmf(ptr ptr ptr)
307 stdcall GdipGetNearestColor(ptr ptr)
308 stdcall GdipGetPageScale(ptr ptr)
309 stdcall GdipGetPageUnit(ptr ptr)
diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c
index 30b2122..8efe122 100644
--- a/dlls/gdiplus/metafile.c
+++ b/dlls/gdiplus/metafile.c
@@ -1064,6 +1064,23 @@ GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf(HENHMETAFILE hemf,
return Ok;
}
+GpStatus WINGDIPAPI GdipGetMetafileHeaderFromWmf(HMETAFILE hwmf,
+ GDIPCONST WmfPlaceableFileHeader *placeable, MetafileHeader *header)
+{
+ GpStatus status;
+ GpMetafile *metafile;
+
+ TRACE("(%p,%p,%p)\n", hwmf, placeable, header);
+
+ status = GdipCreateMetafileFromWmf(hwmf, FALSE, placeable, &metafile);
+ if (status == Ok)
+ {
+ status = GdipGetMetafileHeaderFromMetafile(metafile, header);
+ GdipDisposeImage(&metafile->image);
+ }
+ return status;
+}
+
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromFile(GDIPCONST WCHAR *filename,
MetafileHeader *header)
{
--
2.8.0

View File

@ -0,0 +1,46 @@
From 601c19472c2f57dbefa53deaf0c7bdb7625d7e7c Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 10 May 2016 12:59:48 +0800
Subject: gdiplus: Implement GdipGetMetafileHeaderFromStream.
---
dlls/gdiplus/metafile.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c
index 8efe122..2164d42 100644
--- a/dlls/gdiplus/metafile.c
+++ b/dlls/gdiplus/metafile.c
@@ -1102,19 +1102,21 @@ GpStatus WINGDIPAPI GdipGetMetafileHeaderFromFile(GDIPCONST WCHAR *filename,
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromStream(IStream *stream,
MetafileHeader *header)
{
- static int calls;
+ GpStatus status;
+ GpMetafile *metafile;
TRACE("(%p,%p)\n", stream, header);
- if(!stream || !header)
+ if (!stream || !header)
return InvalidParameter;
- if(!(calls++))
- FIXME("not implemented\n");
-
- memset(header, 0, sizeof(MetafileHeader));
-
- return Ok;
+ status = GdipCreateMetafileFromStream(stream, &metafile);
+ if (status == Ok)
+ {
+ status = GdipGetMetafileHeaderFromMetafile(metafile, header);
+ GdipDisposeImage(&metafile->image);
+ }
+ return status;
}
GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete,
--
2.8.0

View File

@ -0,0 +1,46 @@
From 87e34fa7456d8055ac95b2452cda95cee1856310 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 10 May 2016 13:02:45 +0800
Subject: gdiplus: Implement GdipGetMetafileHeaderFromFile.
---
dlls/gdiplus/metafile.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c
index 2164d42..c4bd727 100644
--- a/dlls/gdiplus/metafile.c
+++ b/dlls/gdiplus/metafile.c
@@ -1084,19 +1084,21 @@ GpStatus WINGDIPAPI GdipGetMetafileHeaderFromWmf(HMETAFILE hwmf,
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromFile(GDIPCONST WCHAR *filename,
MetafileHeader *header)
{
- static int calls;
+ GpStatus status;
+ GpMetafile *metafile;
TRACE("(%s,%p)\n", debugstr_w(filename), header);
- if(!filename || !header)
+ if (!filename || !header)
return InvalidParameter;
- if(!(calls++))
- FIXME("not implemented\n");
-
- memset(header, 0, sizeof(MetafileHeader));
-
- return Ok;
+ status = GdipCreateMetafileFromFile(filename, &metafile);
+ if (status == Ok)
+ {
+ status = GdipGetMetafileHeaderFromMetafile(metafile, header);
+ GdipDisposeImage(&metafile->image);
+ }
+ return status;
}
GpStatus WINGDIPAPI GdipGetMetafileHeaderFromStream(IStream *stream,
--
2.8.0

View File

@ -1 +1,3 @@
Fixes: [40325] Implement GdipCreateMetafileFromStream
Fixes: [27415] Implement GdipGetMetafileHeaderFromMetafile
Depends: oleaut32-OLEPictureImpl_SaveAsFile

View File

@ -2195,6 +2195,13 @@ if test "$enable_ntdll_FileDispositionInformation" -eq 1; then
enable_server_File_Permissions=1
fi
if test "$enable_gdiplus_GdipCreateMetafileFromStream" -eq 1; then
if test "$enable_oleaut32_OLEPictureImpl_SaveAsFile" -gt 1; then
abort "Patchset oleaut32-OLEPictureImpl_SaveAsFile disabled, but gdiplus-GdipCreateMetafileFromStream depends on that."
fi
enable_oleaut32_OLEPictureImpl_SaveAsFile=1
fi
if test "$enable_dxva2_Video_Decoder" -eq 1; then
if test "$enable_winecfg_Staging" -gt 1; then
abort "Patchset winecfg-Staging disabled, but dxva2-Video_Decoder depends on that."
@ -3634,18 +3641,48 @@ if test "$enable_gdi32_Symbol_Truetype_Font" -eq 1; then
) >> "$patchlist"
fi
# Patchset oleaut32-OLEPictureImpl_SaveAsFile
# |
# | This patchset fixes the following Wine bugs:
# | * [#8532] Implement a better stub for IPicture::SaveAsFile
# |
# | Modified files:
# | * dlls/gdiplus/Makefile.in, dlls/gdiplus/gdiplus_private.h, dlls/gdiplus/graphics.c, dlls/gdiplus/image.c,
# | dlls/gdiplus/metafile.c, dlls/gdiplus/tests/image.c, dlls/oleaut32/olepicture.c, dlls/oleaut32/tests/olepicture.c
# |
if test "$enable_oleaut32_OLEPictureImpl_SaveAsFile" -eq 1; then
patch_apply oleaut32-OLEPictureImpl_SaveAsFile/0001-gdiplus-Reimplement-metafile-loading-using-gdi32-ins.patch
patch_apply oleaut32-OLEPictureImpl_SaveAsFile/0002-oleaut32-Implement-a-better-stub-for-IPicture-SaveAs.patch
(
echo '+ { "Dmitry Timoshkov", "gdiplus: Reimplement metafile loading using gdi32 instead of IPicture.", 2 },';
echo '+ { "Dmitry Timoshkov", "oleaut32: Implement a better stub for IPicture::SaveAsFile.", 1 },';
) >> "$patchlist"
fi
# Patchset gdiplus-GdipCreateMetafileFromStream
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * oleaut32-OLEPictureImpl_SaveAsFile
# |
# | This patchset fixes the following Wine bugs:
# | * [#40325] Implement GdipCreateMetafileFromStream
# | * [#27415] Implement GdipGetMetafileHeaderFromMetafile
# |
# | Modified files:
# | * dlls/gdiplus/metafile.c
# | * dlls/gdiplus/gdiplus.spec, dlls/gdiplus/metafile.c, dlls/gdiplus/tests/image.c
# |
if test "$enable_gdiplus_GdipCreateMetafileFromStream" -eq 1; then
patch_apply gdiplus-GdipCreateMetafileFromStream/0001-gdiplus-Implement-GdipCreateMetafileFromStream.patch
patch_apply gdiplus-GdipCreateMetafileFromStream/0002-gdiplus-Implement-GdipGetMetafileHeaderFromMetafile.patch
patch_apply gdiplus-GdipCreateMetafileFromStream/0003-gdiplus-Implement-GdipGetMetafileHeaderFromWmf.patch
patch_apply gdiplus-GdipCreateMetafileFromStream/0004-gdiplus-Implement-GdipGetMetafileHeaderFromStream.patch
patch_apply gdiplus-GdipCreateMetafileFromStream/0005-gdiplus-Implement-GdipGetMetafileHeaderFromFile.patch
(
echo '+ { "Dmitry Timoshkov", "gdiplus: Implement GdipCreateMetafileFromStream.", 1 },';
echo '+ { "Dmitry Timoshkov", "gdiplus: Implement GdipGetMetafileHeaderFromMetafile.", 1 },';
echo '+ { "Dmitry Timoshkov", "gdiplus: Implement GdipGetMetafileHeaderFromWmf.", 1 },';
echo '+ { "Dmitry Timoshkov", "gdiplus: Implement GdipGetMetafileHeaderFromStream.", 1 },';
echo '+ { "Dmitry Timoshkov", "gdiplus: Implement GdipGetMetafileHeaderFromFile.", 1 },';
) >> "$patchlist"
fi
@ -5449,24 +5486,6 @@ if test "$enable_oleaut32_Load_Save_EMF" -eq 1; then
) >> "$patchlist"
fi
# Patchset oleaut32-OLEPictureImpl_SaveAsFile
# |
# | This patchset fixes the following Wine bugs:
# | * [#8532] Implement a better stub for IPicture::SaveAsFile
# |
# | Modified files:
# | * dlls/gdiplus/Makefile.in, dlls/gdiplus/gdiplus_private.h, dlls/gdiplus/graphics.c, dlls/gdiplus/image.c,
# | dlls/gdiplus/metafile.c, dlls/gdiplus/tests/image.c, dlls/oleaut32/olepicture.c, dlls/oleaut32/tests/olepicture.c
# |
if test "$enable_oleaut32_OLEPictureImpl_SaveAsFile" -eq 1; then
patch_apply oleaut32-OLEPictureImpl_SaveAsFile/0001-gdiplus-Reimplement-metafile-loading-using-gdi32-ins.patch
patch_apply oleaut32-OLEPictureImpl_SaveAsFile/0002-oleaut32-Implement-a-better-stub-for-IPicture-SaveAs.patch
(
echo '+ { "Dmitry Timoshkov", "gdiplus: Reimplement metafile loading using gdi32 instead of IPicture.", 2 },';
echo '+ { "Dmitry Timoshkov", "oleaut32: Implement a better stub for IPicture::SaveAsFile.", 1 },';
) >> "$patchlist"
fi
# Patchset oleaut32-OleLoadPicture
# |
# | This patchset fixes the following Wine bugs: