gdiplus: Don't use CoCreateInstance in decode_image_wic.
This commit is contained in:
parent
df9ec3c178
commit
b03c60d85c
|
@ -40,6 +40,8 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
|
||||
|
||||
HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT, IWICImagingFactory**);
|
||||
|
||||
#define PIXELFORMATBPP(x) ((x) ? ((x) >> 8) & 255 : 24)
|
||||
|
||||
static const struct
|
||||
|
@ -3403,12 +3405,13 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
|
|||
|
||||
typedef void (*metadata_reader_func)(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UINT frame);
|
||||
|
||||
static GpStatus decode_image_wic(IStream *stream, GDIPCONST CLSID *clsid,
|
||||
static GpStatus decode_image_wic(IStream *stream, REFGUID container,
|
||||
UINT active_frame, metadata_reader_func metadata_reader, GpImage **image)
|
||||
{
|
||||
GpStatus status=Ok;
|
||||
GpBitmap *bitmap;
|
||||
HRESULT hr;
|
||||
IWICImagingFactory *factory;
|
||||
IWICBitmapDecoder *decoder;
|
||||
IWICBitmapFrameDecode *frame;
|
||||
IWICBitmapSource *source=NULL;
|
||||
|
@ -3423,12 +3426,13 @@ static GpStatus decode_image_wic(IStream *stream, GDIPCONST CLSID *clsid,
|
|||
WICRect wrc;
|
||||
HRESULT initresult;
|
||||
|
||||
TRACE("%p,%s,%u,%p\n", stream, wine_dbgstr_guid(clsid), active_frame, image);
|
||||
TRACE("%p,%s,%u,%p\n", stream, wine_dbgstr_guid(container), active_frame, image);
|
||||
|
||||
initresult = CoInitialize(NULL);
|
||||
|
||||
hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IWICBitmapDecoder, (void**)&decoder);
|
||||
hr = WICCreateImagingFactory_Proxy(WINCODEC_SDK_VERSION, &factory);
|
||||
if (FAILED(hr)) goto end;
|
||||
hr = IWICImagingFactory_CreateDecoder(factory, container, NULL, &decoder);
|
||||
IWICImagingFactory_Release(factory);
|
||||
if (FAILED(hr)) goto end;
|
||||
|
||||
hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnLoad);
|
||||
|
@ -3571,7 +3575,7 @@ end:
|
|||
|
||||
static GpStatus decode_image_icon(IStream* stream, REFCLSID clsid, UINT active_frame, GpImage **image)
|
||||
{
|
||||
return decode_image_wic(stream, &CLSID_WICIcoDecoder, active_frame, NULL, image);
|
||||
return decode_image_wic(stream, &GUID_ContainerFormatIco, active_frame, NULL, image);
|
||||
}
|
||||
|
||||
static GpStatus decode_image_bmp(IStream* stream, REFCLSID clsid, UINT active_frame, GpImage **image)
|
||||
|
@ -3579,7 +3583,7 @@ static GpStatus decode_image_bmp(IStream* stream, REFCLSID clsid, UINT active_fr
|
|||
GpStatus status;
|
||||
GpBitmap* bitmap;
|
||||
|
||||
status = decode_image_wic(stream, &CLSID_WICBmpDecoder, active_frame, NULL, image);
|
||||
status = decode_image_wic(stream, &GUID_ContainerFormatBmp, active_frame, NULL, image);
|
||||
|
||||
bitmap = (GpBitmap*)*image;
|
||||
|
||||
|
@ -3594,22 +3598,22 @@ static GpStatus decode_image_bmp(IStream* stream, REFCLSID clsid, UINT active_fr
|
|||
|
||||
static GpStatus decode_image_jpeg(IStream* stream, REFCLSID clsid, UINT active_frame, GpImage **image)
|
||||
{
|
||||
return decode_image_wic(stream, &CLSID_WICJpegDecoder, active_frame, NULL, image);
|
||||
return decode_image_wic(stream, &GUID_ContainerFormatJpeg, active_frame, NULL, image);
|
||||
}
|
||||
|
||||
static GpStatus decode_image_png(IStream* stream, REFCLSID clsid, UINT active_frame, GpImage **image)
|
||||
{
|
||||
return decode_image_wic(stream, &CLSID_WICPngDecoder, active_frame, NULL, image);
|
||||
return decode_image_wic(stream, &GUID_ContainerFormatPng, active_frame, NULL, image);
|
||||
}
|
||||
|
||||
static GpStatus decode_image_gif(IStream* stream, REFCLSID clsid, UINT active_frame, GpImage **image)
|
||||
{
|
||||
return decode_image_wic(stream, &CLSID_WICGifDecoder, active_frame, gif_metadata_reader, image);
|
||||
return decode_image_wic(stream, &GUID_ContainerFormatGif, active_frame, gif_metadata_reader, image);
|
||||
}
|
||||
|
||||
static GpStatus decode_image_tiff(IStream* stream, REFCLSID clsid, UINT active_frame, GpImage **image)
|
||||
{
|
||||
return decode_image_wic(stream, &CLSID_WICTiffDecoder, active_frame, NULL, image);
|
||||
return decode_image_wic(stream, &GUID_ContainerFormatTiff, active_frame, NULL, image);
|
||||
}
|
||||
|
||||
static GpStatus decode_image_olepicture_metafile(IStream* stream, REFCLSID clsid, UINT active_frame, GpImage **image)
|
||||
|
|
Loading…
Reference in New Issue