Commit 176e4ba4 authored by Kirill K. Smirnov's avatar Kirill K. Smirnov Committed by Alexandre Julliard

gdiplus: Whole picture object should be cloned in GdipCloneImage(), not just parent class 'image'.

parent 4736c993
......@@ -254,6 +254,7 @@ GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage)
HRESULT hr;
INT size;
LARGE_INTEGER move;
GpStatus stat = GenericError;
TRACE("%p, %p\n", image, cloneImage);
......@@ -264,15 +265,6 @@ GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage)
if (FAILED(hr))
return GenericError;
*cloneImage = GdipAlloc(sizeof(GpImage));
if (!*cloneImage)
{
IStream_Release(stream);
return OutOfMemory;
}
(*cloneImage)->type = image->type;
(*cloneImage)->flags = image->flags;
hr = IPicture_SaveAsFile(image->picture, stream, FALSE, &size);
if(FAILED(hr))
{
......@@ -286,21 +278,12 @@ GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage)
if (FAILED(hr))
goto out;
hr = OleLoadPicture(stream, size, FALSE, &IID_IPicture,
(LPVOID*) &(*cloneImage)->picture);
if (FAILED(hr))
{
WARN("Failed to load image from stream\n");
goto out;
}
stat = GdipLoadImageFromStream(stream, cloneImage);
if (stat != Ok) WARN("Failed to load image from stream\n");
IStream_Release(stream);
return Ok;
out:
IStream_Release(stream);
GdipFree(*cloneImage);
*cloneImage = NULL;
return GenericError;
return stat;
}
GpStatus WINGDIPAPI GdipCreateBitmapFromFile(GDIPCONST WCHAR* filename,
......
......@@ -514,6 +514,10 @@ static void test_GdipCloneImage(void)
stat = GdipGetImageBounds(image_dest, &rectF, &unit);
expect(Ok, stat);
/* Treat FP values carefully */
ok(fabsf(rectF.Width-WIDTH)<1e-5, "Expected: %d, got %.05f\n", WIDTH, rectF.Width);
ok(fabsf(rectF.Height-HEIGHT)<1e-5, "Expected: %d, got %.05f\n", HEIGHT, rectF.Height);
stat = GdipDisposeImage(image_dest);
expect(Ok, stat);
}
......
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