windowscodecs: Use predefined WICBitmapPaletteTypeFixedGray4 palette instead of a handmade one.

This commit is contained in:
Dmitry Timoshkov 2012-07-13 10:07:37 +09:00 committed by Alexandre Julliard
parent 9fce6a37ec
commit 045ac64c1a
1 changed files with 10 additions and 12 deletions

View File

@ -185,21 +185,19 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe
IWICPalette *palette;
UINT actualcolors;
res = PaletteImpl_Create(&palette);
if (FAILED(res)) return res;
if (source_format == format_2bppIndexed)
{
res = PaletteImpl_Create(&palette);
if (FAILED(res)) return res;
res = IWICBitmapSource_CopyPalette(This->source, palette);
if (SUCCEEDED(res))
res = IWICPalette_GetColors(palette, 4, colors, &actualcolors);
IWICPalette_Release(palette);
if (FAILED(res)) return res;
}
else
make_grayscale_palette(colors, 4);
res = IWICPalette_InitializePredefined(palette, WICBitmapPaletteTypeFixedGray4, FALSE);
if (SUCCEEDED(res))
res = IWICPalette_GetColors(palette, 4, colors, &actualcolors);
IWICPalette_Release(palette);
if (FAILED(res)) return res;
srcstride = (prc->Width+3)/4;
srcdatasize = srcstride * prc->Height;