Vincent Povirk : gdiplus: Implement GdipGetImageThumbnail.
Alexandre Julliard
julliard at winehq.org
Mon May 10 11:59:10 CDT 2010
Module: wine
Branch: master
Commit: 7dfc674437a113ea2f515dfbc03270c0be42e41b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7dfc674437a113ea2f515dfbc03270c0be42e41b
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Sat May 8 13:29:53 2010 -0500
gdiplus: Implement GdipGetImageThumbnail.
---
dlls/gdiplus/image.c | 41 +++++++++++++++++++++++++++++++++++++++--
dlls/gdiplus/tests/image.c | 10 +++++-----
2 files changed, 44 insertions(+), 7 deletions(-)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 0eaaf2e..8b55115 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -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;
}
/*****************************************************************************
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index 8abb40c..0e33049 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -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)
{
More information about the wine-cvs
mailing list