[PATCH 3/3] windowscodecs: Use source palette if it wasn't specified earlier for PNG frame

Nikolay Sivov nsivov at codeweavers.com
Thu Jan 26 15:35:10 CST 2017


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/windowscodecs/pngformat.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index b13377a4bd..efad550a00 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -1765,6 +1765,18 @@ static HRESULT WINAPI PngFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
 
     if (SUCCEEDED(hr))
     {
+        if (This->colors == 0)
+        {
+            IWICPalette *palette;
+
+            if (SUCCEEDED(PaletteImpl_Create(&palette)))
+            {
+                if (SUCCEEDED(IWICBitmapSource_CopyPalette(pIBitmapSource, palette)))
+                    IWICBitmapFrameEncode_SetPalette(iface, palette);
+                IWICPalette_Release(palette);
+            }
+        }
+
         hr = write_source(iface, pIBitmapSource, prc,
             This->format->guid, This->format->bpp, This->width, This->height);
     }
-- 
2.11.0




More information about the wine-patches mailing list