From 48010c414be83d362ff1293b917aa84c0809d44e Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Sat, 29 May 2010 12:09:56 -0500 Subject: [PATCH 1/2] windowscodecs: Implement TiffFrameDecode_CopyPalette. --- dlls/windowscodecs/tiffformat.c | 30 ++++++++++++++++++++++++++++-- 1 files changed, 28 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c index 645cfb0..2c26325 100644 --- a/dlls/windowscodecs/tiffformat.c +++ b/dlls/windowscodecs/tiffformat.c @@ -692,8 +692,34 @@ static HRESULT WINAPI TiffFrameDecode_GetResolution(IWICBitmapFrameDecode *iface static HRESULT WINAPI TiffFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface, IWICPalette *pIPalette) { - FIXME("(%p,%p)\n", iface, pIPalette); - return E_NOTIMPL; + TiffFrameDecode *This = (TiffFrameDecode*)iface; + uint16 *red, *green, *blue; + WICColor colors[256]; + int color_count, ret, i; + + TRACE("(%p,%p)\n", iface, pIPalette); + + color_count = 1<decode_info.bps; + + EnterCriticalSection(&This->parent->lock); + ret = pTIFFGetField(This->parent->tiff, TIFFTAG_COLORMAP, &red, &green, &blue); + LeaveCriticalSection(&This->parent->lock); + + if (!ret) + { + WARN("Couldn't read color map\n"); + return E_FAIL; + } + + for (i=0; i>8) & 0xff); + } + + return IWICPalette_InitializeCustom(pIPalette, colors, color_count); } static HRESULT TiffFrameDecode_ReadTile(TiffFrameDecode *This, UINT tile_x, UINT tile_y) -- 1.7.1