Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/windowscodecs/bmpdecode.c | 13 +------------ dlls/windowscodecs/gifformat.c | 13 +------------ dlls/windowscodecs/icoformat.c | 13 +------------ dlls/windowscodecs/info.c | 16 ++++++++++++++++ dlls/windowscodecs/jpegformat.c | 13 +------------ dlls/windowscodecs/pngformat.c | 13 +------------ dlls/windowscodecs/tgaformat.c | 13 +------------ dlls/windowscodecs/tiffformat.c | 13 +------------ dlls/windowscodecs/wincodecs_private.h | 1 + 9 files changed, 24 insertions(+), 84 deletions(-)
diff --git a/dlls/windowscodecs/bmpdecode.c b/dlls/windowscodecs/bmpdecode.c index 2bcb81e0d6..4109bad4b3 100644 --- a/dlls/windowscodecs/bmpdecode.c +++ b/dlls/windowscodecs/bmpdecode.c @@ -1068,20 +1068,9 @@ static HRESULT WINAPI BmpDecoder_GetContainerFormat(IWICBitmapDecoder *iface, static HRESULT WINAPI BmpDecoder_GetDecoderInfo(IWICBitmapDecoder *iface, IWICBitmapDecoderInfo **ppIDecoderInfo) { - HRESULT hr; - IWICComponentInfo *compinfo; - TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
- hr = CreateComponentInfo(&CLSID_WICBmpDecoder, &compinfo); - if (FAILED(hr)) return hr; - - hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo, - (void**)ppIDecoderInfo); - - IWICComponentInfo_Release(compinfo); - - return hr; + return get_decoder_info(&CLSID_WICBmpDecoder, ppIDecoderInfo); }
static HRESULT WINAPI BmpDecoder_CopyPalette(IWICBitmapDecoder *iface, diff --git a/dlls/windowscodecs/gifformat.c b/dlls/windowscodecs/gifformat.c index f63a7f37a9..0eb1d804ec 100644 --- a/dlls/windowscodecs/gifformat.c +++ b/dlls/windowscodecs/gifformat.c @@ -1170,20 +1170,9 @@ static HRESULT WINAPI GifDecoder_GetContainerFormat(IWICBitmapDecoder *iface, static HRESULT WINAPI GifDecoder_GetDecoderInfo(IWICBitmapDecoder *iface, IWICBitmapDecoderInfo **ppIDecoderInfo) { - HRESULT hr; - IWICComponentInfo *compinfo; - TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
- hr = CreateComponentInfo(&CLSID_WICGifDecoder, &compinfo); - if (FAILED(hr)) return hr; - - hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo, - (void**)ppIDecoderInfo); - - IWICComponentInfo_Release(compinfo); - - return hr; + return get_decoder_info(&CLSID_WICGifDecoder, ppIDecoderInfo); }
static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalette *palette) diff --git a/dlls/windowscodecs/icoformat.c b/dlls/windowscodecs/icoformat.c index 1b1c79291b..5e38ee0d0f 100644 --- a/dlls/windowscodecs/icoformat.c +++ b/dlls/windowscodecs/icoformat.c @@ -556,20 +556,9 @@ static HRESULT WINAPI IcoDecoder_GetContainerFormat(IWICBitmapDecoder *iface, static HRESULT WINAPI IcoDecoder_GetDecoderInfo(IWICBitmapDecoder *iface, IWICBitmapDecoderInfo **ppIDecoderInfo) { - HRESULT hr; - IWICComponentInfo *compinfo; - TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
- hr = CreateComponentInfo(&CLSID_WICIcoDecoder, &compinfo); - if (FAILED(hr)) return hr; - - hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo, - (void**)ppIDecoderInfo); - - IWICComponentInfo_Release(compinfo); - - return hr; + return get_decoder_info(&CLSID_WICIcoDecoder, ppIDecoderInfo); }
static HRESULT WINAPI IcoDecoder_CopyPalette(IWICBitmapDecoder *iface, diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c index 6114eef557..fadefba50d 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -2029,6 +2029,22 @@ void ReleaseComponentInfos(void) IWICComponentInfo_Release(&info->IWICComponentInfo_iface); }
+HRESULT get_decoder_info(const CLSID *clsid, IWICBitmapDecoderInfo **info) +{ + IWICComponentInfo *compinfo; + HRESULT hr; + + hr = CreateComponentInfo(clsid, &compinfo); + if (FAILED(hr)) return hr; + + hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo, + (void **)info); + + IWICComponentInfo_Release(compinfo); + + return hr; +} + typedef struct { IEnumUnknown IEnumUnknown_iface; LONG ref; diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c index 27cd88036b..f05663f070 100644 --- a/dlls/windowscodecs/jpegformat.c +++ b/dlls/windowscodecs/jpegformat.c @@ -398,20 +398,9 @@ static HRESULT WINAPI JpegDecoder_GetContainerFormat(IWICBitmapDecoder *iface, static HRESULT WINAPI JpegDecoder_GetDecoderInfo(IWICBitmapDecoder *iface, IWICBitmapDecoderInfo **ppIDecoderInfo) { - HRESULT hr; - IWICComponentInfo *compinfo; - TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
- hr = CreateComponentInfo(&CLSID_WICJpegDecoder, &compinfo); - if (FAILED(hr)) return hr; - - hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo, - (void**)ppIDecoderInfo); - - IWICComponentInfo_Release(compinfo); - - return hr; + return get_decoder_info(&CLSID_WICJpegDecoder, ppIDecoderInfo); }
static HRESULT WINAPI JpegDecoder_CopyPalette(IWICBitmapDecoder *iface, diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index 26b5fd52bc..fd0d197bb3 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -829,20 +829,9 @@ static HRESULT WINAPI PngDecoder_GetContainerFormat(IWICBitmapDecoder *iface, static HRESULT WINAPI PngDecoder_GetDecoderInfo(IWICBitmapDecoder *iface, IWICBitmapDecoderInfo **ppIDecoderInfo) { - HRESULT hr; - IWICComponentInfo *compinfo; - TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
- hr = CreateComponentInfo(&CLSID_WICPngDecoder, &compinfo); - if (FAILED(hr)) return hr; - - hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo, - (void**)ppIDecoderInfo); - - IWICComponentInfo_Release(compinfo); - - return hr; + return get_decoder_info(&CLSID_WICPngDecoder, ppIDecoderInfo); }
static HRESULT WINAPI PngDecoder_CopyPalette(IWICBitmapDecoder *iface, diff --git a/dlls/windowscodecs/tgaformat.c b/dlls/windowscodecs/tgaformat.c index ec7fa23169..b3d9aeae26 100644 --- a/dlls/windowscodecs/tgaformat.c +++ b/dlls/windowscodecs/tgaformat.c @@ -360,20 +360,9 @@ static HRESULT WINAPI TgaDecoder_GetContainerFormat(IWICBitmapDecoder *iface, static HRESULT WINAPI TgaDecoder_GetDecoderInfo(IWICBitmapDecoder *iface, IWICBitmapDecoderInfo **ppIDecoderInfo) { - HRESULT hr; - IWICComponentInfo *compinfo; - TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
- hr = CreateComponentInfo(&CLSID_WineTgaDecoder, &compinfo); - if (FAILED(hr)) return hr; - - hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo, - (void**)ppIDecoderInfo); - - IWICComponentInfo_Release(compinfo); - - return hr; + return get_decoder_info(&CLSID_WineTgaDecoder, ppIDecoderInfo); }
static HRESULT WINAPI TgaDecoder_CopyPalette(IWICBitmapDecoder *iface, diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c index 6fe3f19677..2b2f84f859 100644 --- a/dlls/windowscodecs/tiffformat.c +++ b/dlls/windowscodecs/tiffformat.c @@ -672,20 +672,9 @@ static HRESULT WINAPI TiffDecoder_GetContainerFormat(IWICBitmapDecoder *iface, static HRESULT WINAPI TiffDecoder_GetDecoderInfo(IWICBitmapDecoder *iface, IWICBitmapDecoderInfo **ppIDecoderInfo) { - HRESULT hr; - IWICComponentInfo *compinfo; - TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
- hr = CreateComponentInfo(&CLSID_WICTiffDecoder, &compinfo); - if (FAILED(hr)) return hr; - - hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo, - (void**)ppIDecoderInfo); - - IWICComponentInfo_Release(compinfo); - - return hr; + return get_decoder_info(&CLSID_WICTiffDecoder, ppIDecoderInfo); }
static HRESULT WINAPI TiffDecoder_CopyPalette(IWICBitmapDecoder *iface, diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h index 037bde2da0..b29fc1fa4d 100644 --- a/dlls/windowscodecs/wincodecs_private.h +++ b/dlls/windowscodecs/wincodecs_private.h @@ -126,6 +126,7 @@ extern HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count, extern HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo) DECLSPEC_HIDDEN; extern void ReleaseComponentInfos(void) DECLSPEC_HIDDEN; extern HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown) DECLSPEC_HIDDEN; +extern HRESULT get_decoder_info(REFCLSID clsid, IWICBitmapDecoderInfo **info) DECLSPEC_HIDDEN;
typedef struct BmpDecoder BmpDecoder;