From a0f9a251f94ef21b5af63d01f9120f30a71e8c22 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 16 Jul 2012 14:54:32 +0900 Subject: [PATCH] windowscodecs: Use predefined WICBitmapPaletteTypeFixedBW palette instead of a hand-made one. --- dlls/windowscodecs/converter.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c index 98e727e2588..6ee3a165ea2 100644 --- a/dlls/windowscodecs/converter.c +++ b/dlls/windowscodecs/converter.c @@ -103,24 +103,19 @@ static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRe IWICPalette *palette; UINT actualcolors; - if (source_format == format_1bppIndexed) - { - res = PaletteImpl_Create(&palette); - if (FAILED(res)) return res; + res = PaletteImpl_Create(&palette); + if (FAILED(res)) return res; + if (source_format == format_1bppIndexed) res = IWICBitmapSource_CopyPalette(This->source, palette); - if (SUCCEEDED(res)) - res = IWICPalette_GetColors(palette, 2, colors, &actualcolors); + else + res = IWICPalette_InitializePredefined(palette, WICBitmapPaletteTypeFixedBW, FALSE); - IWICPalette_Release(palette); + if (SUCCEEDED(res)) + res = IWICPalette_GetColors(palette, 2, colors, &actualcolors); - if (FAILED(res)) return res; - } - else - { - colors[0] = 0xff000000; - colors[1] = 0xffffffff; - } + IWICPalette_Release(palette); + if (FAILED(res)) return res; srcstride = (prc->Width+7)/8; srcdatasize = srcstride * prc->Height; -- 2.11.4.GIT