diff --git a/dlls/windowscodecs/proxy.c b/dlls/windowscodecs/proxy.c index 2f727b40e73..91fb6e69d90 100644 --- a/dlls/windowscodecs/proxy.c +++ b/dlls/windowscodecs/proxy.c @@ -633,3 +633,43 @@ HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT SDKVersion, IWICImagingFactory return ComponentFactory_CreateInstance(NULL, &IID_IWICImagingFactory, (void**)ppIImagingFactory); } + +HRESULT WINAPI WICSetEncoderFormat_Proxy(IWICBitmapSource *pSourceIn, + IWICPalette *pIPalette, IWICBitmapFrameEncode *pIFrameEncode, + IWICBitmapSource **ppSourceOut) +{ + HRESULT hr; + WICPixelFormatGUID pixelformat, framepixelformat; + + TRACE("%p,%p,%p,%p\n", pSourceIn, pIPalette, pIFrameEncode, ppSourceOut); + + if (pIPalette) FIXME("ignoring palette\n"); + + if (!pSourceIn || !pIFrameEncode || !ppSourceOut) + return E_INVALIDARG; + + *ppSourceOut = NULL; + + hr = IWICBitmapSource_GetPixelFormat(pSourceIn, &pixelformat); + + if (SUCCEEDED(hr)) + { + framepixelformat = pixelformat; + hr = IWICBitmapFrameEncode_SetPixelFormat(pIFrameEncode, &framepixelformat); + } + + if (SUCCEEDED(hr)) + { + if (IsEqualGUID(&pixelformat, &framepixelformat)) + { + *ppSourceOut = pSourceIn; + IWICBitmapSource_AddRef(pSourceIn); + } + else + { + hr = WICConvertBitmapSource(&framepixelformat, pSourceIn, ppSourceOut); + } + } + + return hr; +} diff --git a/dlls/windowscodecs/windowscodecs.spec b/dlls/windowscodecs/windowscodecs.spec index 3d70084cc51..9497aec01be 100644 --- a/dlls/windowscodecs/windowscodecs.spec +++ b/dlls/windowscodecs/windowscodecs.spec @@ -114,4 +114,4 @@ @ stub WICMapShortNameToGuid @ stub WICMatchMetadataContent @ stub WICSerializeMetadataContent -@ stub WICSetEncoderFormat_Proxy +@ stdcall WICSetEncoderFormat_Proxy(ptr ptr ptr ptr)