From 9615dd8fdba958150dd7d3ea05eb8ae97c55bed4 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Fri, 11 Dec 2009 17:00:19 -0600 Subject: [PATCH] gdiplus: Implement GdipGetImagePalette. --- dlls/gdiplus/image.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 74c3f11a9c0..982956c4643 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -2242,15 +2242,22 @@ GpStatus WINGDIPAPI GdipSaveImageToStream(GpImage *image, IStream* stream, */ GpStatus WINGDIPAPI GdipGetImagePalette(GpImage *image, ColorPalette *palette, INT size) { - static int calls = 0; + TRACE("(%p,%p,%i)\n", image, palette, size); - if(!image) + if (!image || !palette) return InvalidParameter; - if(!(calls++)) - FIXME("not implemented\n"); + if (size < (sizeof(UINT)*2+sizeof(ARGB)*image->palette_count)) + { + TRACE("<-- InsufficientBuffer\n"); + return InsufficientBuffer; + } - return NotImplemented; + palette->Flags = image->palette_flags; + palette->Count = image->palette_count; + memcpy(palette->Entries, image->palette_entries, sizeof(ARGB)*image->palette_count); + + return Ok; } /***************************************************************************** -- 2.11.4.GIT