wincodecs: Add a helper for GetDecoderInfo().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-04-01 11:49:12 +03:00 committed by Alexandre Julliard
parent 074345edd6
commit aaea92198d
9 changed files with 24 additions and 84 deletions

View file

@ -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,

View file

@ -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)

View file

@ -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,

View file

@ -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;

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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,

View file

@ -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;