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>
This commit is contained in:
Florian Will 2022-01-24 10:49:39 +01:00 committed by Alexandre Julliard
parent 513feedff7
commit 6090276b3e
2 changed files with 16 additions and 2 deletions

View file

@ -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 = \

View file

@ -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,6 +4571,19 @@ static GpStatus encode_frame_wic(IWICBitmapEncoder *encoder, GpImage *image)
if (SUCCEEDED(hr)) /* created frame */
{
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))