Commit 3738c6b0 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

windowscodecs: Generate global GIF palette even a real one is missing.

parent f6c73a22
...@@ -1180,14 +1180,14 @@ static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalet ...@@ -1180,14 +1180,14 @@ static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalet
GifDecoder *This = impl_from_IWICBitmapDecoder(iface); GifDecoder *This = impl_from_IWICBitmapDecoder(iface);
WICColor colors[256]; WICColor colors[256];
ColorMapObject *cm; ColorMapObject *cm;
int i, trans; int i, trans, count;
ExtensionBlock *eb; ExtensionBlock *eb;
TRACE("(%p,%p)\n", iface, palette); TRACE("(%p,%p)\n", iface, palette);
cm = This->gif->SColorMap; cm = This->gif->SColorMap;
if (!cm) return WINCODEC_ERR_FRAMEMISSING; if (cm)
{
if (cm->ColorCount > 256) if (cm->ColorCount > 256)
{ {
ERR("GIF contains invalid number of colors: %d\n", cm->ColorCount); ERR("GIF contains invalid number of colors: %d\n", cm->ColorCount);
...@@ -1202,6 +1202,19 @@ static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalet ...@@ -1202,6 +1202,19 @@ static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalet
cm->Colors[i].Blue; cm->Colors[i].Blue;
} }
count = cm->ColorCount;
}
else
{
colors[0] = 0xff000000;
colors[1] = 0xffffffff;
for (i = 2; i < 256; i++)
colors[i] = 0xff000000;
count = 256;
}
/* look for the transparent color extension */ /* look for the transparent color extension */
for (i = 0; i < This->gif->SavedImages[This->current_frame].Extensions.ExtensionBlockCount; i++) for (i = 0; i < This->gif->SavedImages[This->current_frame].Extensions.ExtensionBlockCount; i++)
{ {
...@@ -1217,7 +1230,7 @@ static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalet ...@@ -1217,7 +1230,7 @@ static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalet
} }
} }
return IWICPalette_InitializeCustom(palette, colors, cm->ColorCount); return IWICPalette_InitializeCustom(palette, colors, count);
} }
static HRESULT WINAPI GifDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface, static HRESULT WINAPI GifDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface,
......
...@@ -284,7 +284,6 @@ static void test_local_gif_palette(void) ...@@ -284,7 +284,6 @@ static void test_local_gif_palette(void)
/* global palette */ /* global palette */
hr = IWICBitmapDecoder_CopyPalette(decoder, palette); hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
todo_wine
ok(hr == S_OK || broken(hr == WINCODEC_ERR_FRAMEMISSING), "CopyPalette %#x\n", hr); ok(hr == S_OK || broken(hr == WINCODEC_ERR_FRAMEMISSING), "CopyPalette %#x\n", hr);
if (hr == S_OK) if (hr == S_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