Module: wine Branch: master Commit: 6090276b3eadcf22470b68a77a69736e36da0622 URL: https://source.winehq.org/git/wine.git/?a=commit;h=6090276b3eadcf22470b68a77...
Author: Florian Will florian.will@gmail.com Date: Mon Jan 24 10:49:39 2022 +0100
gdiplus: Disable PNG encoding filters.
This speeds up the encoding process, sometimes at the cost of increased PNG file sizes. PNGs created using gdiplus on Windows 10 have filters disabled, too, according to pngcheck.
The application "ZusiDisplay" encodes finished frames in PNG format and sends them through a named pipe for "Zusi 3" to use as an in-game texture, so performance matters for that use case to improve "embedded display" FPS.
Signed-off-by: Florian Will florian.will@gmail.com Signed-off-by: Esme Povirk esme@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdiplus/Makefile.in | 2 +- dlls/gdiplus/image.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/Makefile.in b/dlls/gdiplus/Makefile.in index ac12bd1c613..c87ec5ba827 100644 --- a/dlls/gdiplus/Makefile.in +++ b/dlls/gdiplus/Makefile.in @@ -1,6 +1,6 @@ MODULE = gdiplus.dll IMPORTLIB = gdiplus -IMPORTS = uuid shlwapi ole32 user32 gdi32 +IMPORTS = uuid shlwapi ole32 oleaut32 user32 gdi32 DELAYIMPORTS = windowscodecs
C_SRCS = \ diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 518a9bf8689..56eb62392ec 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -4544,6 +4544,7 @@ static GpStatus encode_frame_wic(IWICBitmapEncoder *encoder, GpImage *image) GpBitmap *bitmap; IWICBitmapFrameEncode *frameencode; IPropertyBag2 *encoderoptions; + GUID container_format; HRESULT hr; UINT width, height; PixelFormat gdipformat=0; @@ -4570,7 +4571,20 @@ static GpStatus encode_frame_wic(IWICBitmapEncoder *encoder, GpImage *image)
if (SUCCEEDED(hr)) /* created frame */ { - hr = IWICBitmapFrameEncode_Initialize(frameencode, encoderoptions); + hr = IWICBitmapEncoder_GetContainerFormat(encoder, &container_format); + if (SUCCEEDED(hr) && IsEqualGUID(&container_format, &GUID_ContainerFormatPng)) + { + /* disable PNG filters for faster encoding */ + PROPBAG2 filter_option = { .pstrName = (LPOLESTR) L"FilterOption" }; + VARIANT filter_value; + VariantInit(&filter_value); + V_VT(&filter_value) = VT_UI1; + V_UI1(&filter_value) = WICPngFilterNone; + hr = IPropertyBag2_Write(encoderoptions, 1, &filter_option, &filter_value); + } + + if (SUCCEEDED(hr)) + hr = IWICBitmapFrameEncode_Initialize(frameencode, encoderoptions);
if (SUCCEEDED(hr)) hr = IWICBitmapFrameEncode_SetSize(frameencode, width, height);