Commit 2dc56858 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Placeable is optional in GdipCreateMetafileFromWmf.

parent c7bdc888
...@@ -1076,7 +1076,7 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete, ...@@ -1076,7 +1076,7 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
TRACE("(%p, %d, %p, %p)\n", hwmf, delete, placeable, metafile); TRACE("(%p, %d, %p, %p)\n", hwmf, delete, placeable, metafile);
if(!hwmf || !metafile || !placeable) if(!hwmf || !metafile)
return InvalidParameter; return InvalidParameter;
*metafile = NULL; *metafile = NULL;
...@@ -1094,6 +1094,8 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete, ...@@ -1094,6 +1094,8 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
if (retval == Ok) if (retval == Ok)
{ {
if (placeable)
{
(*metafile)->image.xres = (REAL)placeable->Inch; (*metafile)->image.xres = (REAL)placeable->Inch;
(*metafile)->image.yres = (REAL)placeable->Inch; (*metafile)->image.yres = (REAL)placeable->Inch;
(*metafile)->bounds.X = ((REAL)placeable->BoundingBox.Left) / ((REAL)placeable->Inch); (*metafile)->bounds.X = ((REAL)placeable->BoundingBox.Left) / ((REAL)placeable->Inch);
...@@ -1103,6 +1105,9 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete, ...@@ -1103,6 +1105,9 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
(*metafile)->bounds.Height = (REAL)(placeable->BoundingBox.Bottom - (*metafile)->bounds.Height = (REAL)(placeable->BoundingBox.Bottom -
placeable->BoundingBox.Top); placeable->BoundingBox.Top);
(*metafile)->metafile_type = MetafileTypeWmfPlaceable; (*metafile)->metafile_type = MetafileTypeWmfPlaceable;
}
else
(*metafile)->metafile_type = MetafileTypeWmf;
(*metafile)->image.format = ImageFormatWMF; (*metafile)->image.format = ImageFormatWMF;
if (delete) DeleteMetaFile(hwmf); if (delete) DeleteMetaFile(hwmf);
......
...@@ -1544,6 +1544,22 @@ static void test_createfromwmf(void) ...@@ -1544,6 +1544,22 @@ static void test_createfromwmf(void)
GdipDisposeImage(img); 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) static void test_resolution(void)
{ {
GpStatus stat; GpStatus stat;
...@@ -4758,6 +4774,7 @@ START_TEST(image) ...@@ -4758,6 +4774,7 @@ START_TEST(image)
test_getrawformat(); test_getrawformat();
test_loadwmf(); test_loadwmf();
test_createfromwmf(); test_createfromwmf();
test_createfromwmf_noplaceable();
test_resolution(); test_resolution();
test_createhbitmap(); test_createhbitmap();
test_getthumbnail(); test_getthumbnail();
......
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