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

Alexandre Julliard julliard at winehq.org
Fri Jul 13 14:11:18 CDT 2012


Module: wine
Branch: master
Commit: 045ac64c1a65a59ddda67d190ab821680175d068
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=045ac64c1a65a59ddda67d190ab821680175d068

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Jul 13 10:07:37 2012 +0900

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

---

 dlls/windowscodecs/converter.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

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




More information about the wine-cvs mailing list