Vincent Povirk : gdiplus: Placeable is optional in GdipCreateMetafileFromWmf.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Nov 3 09:21:42 CST 2015
Module: wine
Branch: master
Commit: 2dc568589794ae1110bbe6c534b1e3a2b7baeec5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2dc568589794ae1110bbe6c534b1e3a2b7baeec5
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Mon Nov 2 15:20:39 2015 -0600
gdiplus: Placeable is optional in GdipCreateMetafileFromWmf.
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdiplus/metafile.c | 25 +++++++++++++++----------
dlls/gdiplus/tests/image.c | 17 +++++++++++++++++
2 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c
index ad1b7fc..922c101 100644
--- a/dlls/gdiplus/metafile.c
+++ b/dlls/gdiplus/metafile.c
@@ -1076,7 +1076,7 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
TRACE("(%p, %d, %p, %p)\n", hwmf, delete, placeable, metafile);
- if(!hwmf || !metafile || !placeable)
+ if(!hwmf || !metafile)
return InvalidParameter;
*metafile = NULL;
@@ -1094,15 +1094,20 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
if (retval == Ok)
{
- (*metafile)->image.xres = (REAL)placeable->Inch;
- (*metafile)->image.yres = (REAL)placeable->Inch;
- (*metafile)->bounds.X = ((REAL)placeable->BoundingBox.Left) / ((REAL)placeable->Inch);
- (*metafile)->bounds.Y = ((REAL)placeable->BoundingBox.Top) / ((REAL)placeable->Inch);
- (*metafile)->bounds.Width = (REAL)(placeable->BoundingBox.Right -
- placeable->BoundingBox.Left);
- (*metafile)->bounds.Height = (REAL)(placeable->BoundingBox.Bottom -
- placeable->BoundingBox.Top);
- (*metafile)->metafile_type = MetafileTypeWmfPlaceable;
+ if (placeable)
+ {
+ (*metafile)->image.xres = (REAL)placeable->Inch;
+ (*metafile)->image.yres = (REAL)placeable->Inch;
+ (*metafile)->bounds.X = ((REAL)placeable->BoundingBox.Left) / ((REAL)placeable->Inch);
+ (*metafile)->bounds.Y = ((REAL)placeable->BoundingBox.Top) / ((REAL)placeable->Inch);
+ (*metafile)->bounds.Width = (REAL)(placeable->BoundingBox.Right -
+ placeable->BoundingBox.Left);
+ (*metafile)->bounds.Height = (REAL)(placeable->BoundingBox.Bottom -
+ placeable->BoundingBox.Top);
+ (*metafile)->metafile_type = MetafileTypeWmfPlaceable;
+ }
+ else
+ (*metafile)->metafile_type = MetafileTypeWmf;
(*metafile)->image.format = ImageFormatWMF;
if (delete) DeleteMetaFile(hwmf);
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index c14f684..d3e7202 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -1544,6 +1544,22 @@ static void test_createfromwmf(void)
GdipDisposeImage(img);
}
+static void test_createfromwmf_noplaceable(void)
+{
+ HMETAFILE hwmf;
+ GpImage *img;
+ GpStatus stat;
+
+ hwmf = SetMetaFileBitsEx(sizeof(wmfimage)-sizeof(WmfPlaceableFileHeader),
+ wmfimage+sizeof(WmfPlaceableFileHeader));
+ ok(hwmf != 0, "SetMetaFileBitsEx failed\n");
+
+ stat = GdipCreateMetafileFromWmf(hwmf, TRUE, NULL, (GpMetafile**)&img);
+ expect(Ok, stat);
+
+ GdipDisposeImage(img);
+}
+
static void test_resolution(void)
{
GpStatus stat;
@@ -4758,6 +4774,7 @@ START_TEST(image)
test_getrawformat();
test_loadwmf();
test_createfromwmf();
+ test_createfromwmf_noplaceable();
test_resolution();
test_createhbitmap();
test_getthumbnail();
More information about the wine-cvs
mailing list