Commit 7dfc6744 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Implement GdipGetImageThumbnail.

parent 635fe30e
......@@ -3515,9 +3515,46 @@ GpStatus WINGDIPAPI GdipGetImageThumbnail(GpImage *image, UINT width, UINT heigh
GpImage **ret_image, GetThumbnailImageAbort cb,
VOID * cb_data)
{
FIXME("(%p %u %u %p %p %p) stub\n",
GpStatus stat;
GpGraphics *graphics;
UINT srcwidth, srcheight;
TRACE("(%p %u %u %p %p %p)\n",
image, width, height, ret_image, cb, cb_data);
return NotImplemented;
if (!image || !ret_image)
return InvalidParameter;
if (!width) width = 120;
if (!height) height = 120;
GdipGetImageWidth(image, &srcwidth);
GdipGetImageHeight(image, &srcheight);
stat = GdipCreateBitmapFromScan0(width, height, 0, PixelFormat32bppARGB,
NULL, (GpBitmap**)ret_image);
if (stat == Ok)
{
stat = GdipGetImageGraphicsContext(*ret_image, &graphics);
if (stat == Ok)
{
stat = GdipDrawImageRectRectI(graphics, image,
0, 0, width, height, 0, 0, srcwidth, srcheight, UnitPixel,
NULL, NULL, NULL);
GdipDeleteGraphics(graphics);
}
if (stat != Ok)
{
GdipDisposeImage(*ret_image);
*ret_image = NULL;
}
}
return stat;
}
/*****************************************************************************
......
......@@ -1219,16 +1219,16 @@ static void test_getthumbnail(void)
UINT width, height;
stat = GdipGetImageThumbnail(NULL, 0, 0, &bitmap2, NULL, NULL);
todo_wine expect(InvalidParameter, stat);
expect(InvalidParameter, stat);
stat = GdipCreateBitmapFromScan0(128, 128, 0, PixelFormat32bppRGB, NULL, (GpBitmap**)&bitmap1);
expect(Ok, stat);
stat = GdipGetImageThumbnail(bitmap1, 0, 0, NULL, NULL, NULL);
todo_wine expect(InvalidParameter, stat);
expect(InvalidParameter, stat);
stat = GdipGetImageThumbnail(bitmap1, 0, 0, &bitmap2, NULL, NULL);
todo_wine expect(Ok, stat);
expect(Ok, stat);
if (stat == Ok)
{
......@@ -1250,7 +1250,7 @@ static void test_getthumbnail(void)
expect(Ok, stat);
stat = GdipGetImageThumbnail(bitmap1, 32, 32, &bitmap2, NULL, NULL);
todo_wine expect(Ok, stat);
expect(Ok, stat);
if (stat == Ok)
{
......@@ -1266,7 +1266,7 @@ static void test_getthumbnail(void)
}
stat = GdipGetImageThumbnail(bitmap1, 0, 0, &bitmap2, NULL, NULL);
todo_wine expect(Ok, stat);
expect(Ok, stat);
if (stat == Ok)
{
......
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