From d235a6b9156aef5e15b1980b71970ef0603f3d42 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Thu, 24 Apr 2014 12:12:56 +0000 Subject: [PATCH] [WINDOWSCODECS] * Sync with Wine 1.7.17. CORE-8080 svn path=/trunk/; revision=62936 --- reactos/dll/win32/windowscodecs/bitmap.c | 253 +++++++++++++++++- reactos/dll/win32/windowscodecs/bmpdecode.c | 14 +- reactos/dll/win32/windowscodecs/bmpencode.c | 6 +- reactos/dll/win32/windowscodecs/clsfactory.c | 8 +- reactos/dll/win32/windowscodecs/converter.c | 6 +- reactos/dll/win32/windowscodecs/gifformat.c | 28 +- reactos/dll/win32/windowscodecs/guid.c | 1 + reactos/dll/win32/windowscodecs/icnsformat.c | 8 +- reactos/dll/win32/windowscodecs/icoformat.c | 10 +- reactos/dll/win32/windowscodecs/imgfactory.c | 172 +++++++++++- reactos/dll/win32/windowscodecs/info.c | 4 +- reactos/dll/win32/windowscodecs/jpegformat.c | 40 ++- .../dll/win32/windowscodecs/metadatahandler.c | 12 +- reactos/dll/win32/windowscodecs/pngformat.c | 24 +- reactos/dll/win32/windowscodecs/proxy.c | 48 +++- reactos/dll/win32/windowscodecs/regsvr.c | 90 +++---- reactos/dll/win32/windowscodecs/tgaformat.c | 6 +- reactos/dll/win32/windowscodecs/tiffformat.c | 16 +- .../win32/windowscodecs/wincodecs_private.h | 87 ++++-- .../win32/windowscodecs/windowscodecs.spec | 4 +- .../windowscodecs/windowscodecs_wincodec.idl | 3 + reactos/media/doc/README.WINE | 2 +- 22 files changed, 656 insertions(+), 186 deletions(-) diff --git a/reactos/dll/win32/windowscodecs/bitmap.c b/reactos/dll/win32/windowscodecs/bitmap.c index 93bc210be32..dfd7dda89fa 100644 --- a/reactos/dll/win32/windowscodecs/bitmap.c +++ b/reactos/dll/win32/windowscodecs/bitmap.c @@ -18,9 +18,15 @@ #include "wincodecs_private.h" +/* WARNING: .NET Media Integration Layer (MIL) directly dereferences + * BitmapImpl members and depends on its exact layout. + */ typedef struct BitmapImpl { - IWICBitmap IWICBitmap_iface; + IMILUnknown1 IMILUnknown1_iface; LONG ref; + IMILBitmapSource IMILBitmapSource_iface; + IWICBitmap IWICBitmap_iface; + IMILUnknown2 IMILUnknown2_iface; IWICPalette *palette; int palette_set; LONG lock; /* 0 if not locked, -1 if locked for writing, count if locked for reading */ @@ -46,6 +52,21 @@ static inline BitmapImpl *impl_from_IWICBitmap(IWICBitmap *iface) return CONTAINING_RECORD(iface, BitmapImpl, IWICBitmap_iface); } +static inline BitmapImpl *impl_from_IMILBitmapSource(IMILBitmapSource *iface) +{ + return CONTAINING_RECORD(iface, BitmapImpl, IMILBitmapSource_iface); +} + +static inline BitmapImpl *impl_from_IMILUnknown1(IMILUnknown1 *iface) +{ + return CONTAINING_RECORD(iface, BitmapImpl, IMILUnknown1_iface); +} + +static inline BitmapImpl *impl_from_IMILUnknown2(IMILUnknown2 *iface) +{ + return CONTAINING_RECORD(iface, BitmapImpl, IMILUnknown2_iface); +} + static inline BitmapLockImpl *impl_from_IWICBitmapLock(IWICBitmapLock *iface) { return CONTAINING_RECORD(iface, BitmapLockImpl, IWICBitmapLock_iface); @@ -213,6 +234,10 @@ static HRESULT WINAPI BitmapImpl_QueryInterface(IWICBitmap *iface, REFIID iid, { *ppv = &This->IWICBitmap_iface; } + else if (IsEqualIID(&IID_IMILBitmapSource, iid)) + { + *ppv = &This->IMILBitmapSource_iface; + } else { *ppv = NULL; @@ -431,6 +456,229 @@ static const IWICBitmapVtbl BitmapImpl_Vtbl = { BitmapImpl_SetResolution }; +static HRESULT WINAPI IMILBitmapImpl_QueryInterface(IMILBitmapSource *iface, REFIID iid, + void **ppv) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_IMILBitmapSource, iid)) + { + IUnknown_AddRef(&This->IMILBitmapSource_iface); + *ppv = &This->IMILBitmapSource_iface; + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI IMILBitmapImpl_AddRef(IMILBitmapSource *iface) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + return IWICBitmap_AddRef(&This->IWICBitmap_iface); +} + +static ULONG WINAPI IMILBitmapImpl_Release(IMILBitmapSource *iface) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + return IWICBitmap_Release(&This->IWICBitmap_iface); +} + +static HRESULT WINAPI IMILBitmapImpl_GetSize(IMILBitmapSource *iface, + UINT *width, UINT *height) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + return IWICBitmap_GetSize(&This->IWICBitmap_iface, width, height); +} + +static const struct +{ + const GUID *WIC_format; + int enum_format; +} pixel_fmt_map[] = +{ + { &GUID_WICPixelFormatDontCare, 0 }, + { &GUID_WICPixelFormat1bppIndexed, 1 }, + { &GUID_WICPixelFormat2bppIndexed, 2 }, + { &GUID_WICPixelFormat4bppIndexed, 3 }, + { &GUID_WICPixelFormat8bppIndexed, 4 }, + { &GUID_WICPixelFormatBlackWhite, 5 }, + { &GUID_WICPixelFormat2bppGray, 6 }, + { &GUID_WICPixelFormat4bppGray, 7 }, + { &GUID_WICPixelFormat8bppGray, 8 }, + { &GUID_WICPixelFormat16bppBGR555, 9 }, + { &GUID_WICPixelFormat16bppBGR565, 0x0a }, + { &GUID_WICPixelFormat16bppGray, 0x0b }, + { &GUID_WICPixelFormat24bppBGR, 0x0c }, + { &GUID_WICPixelFormat24bppRGB, 0x0d }, + { &GUID_WICPixelFormat32bppBGR, 0x0e }, + { &GUID_WICPixelFormat32bppBGRA, 0x0f }, + { &GUID_WICPixelFormat32bppPBGRA, 0x10 }, + { &GUID_WICPixelFormat48bppRGB, 0x15 }, + { &GUID_WICPixelFormat64bppRGBA, 0x16 }, + { &GUID_WICPixelFormat64bppPRGBA, 0x17 }, + { &GUID_WICPixelFormat32bppCMYK, 0x1c } +}; + +static HRESULT WINAPI IMILBitmapImpl_GetPixelFormat(IMILBitmapSource *iface, + int *format) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + int i; + + TRACE("(%p,%p)\n", iface, format); + + if (!format) return E_INVALIDARG; + + *format = 0; + + for (i = 0; i < sizeof(pixel_fmt_map)/sizeof(pixel_fmt_map[0]); i++) + { + if (IsEqualGUID(pixel_fmt_map[i].WIC_format, &This->pixelformat)) + { + *format = pixel_fmt_map[i].enum_format; + break; + } + } + + return S_OK; +} + +static HRESULT WINAPI IMILBitmapImpl_GetResolution(IMILBitmapSource *iface, + double *dpix, double *dpiy) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + return IWICBitmap_GetResolution(&This->IWICBitmap_iface, dpix, dpiy); +} + +static HRESULT WINAPI IMILBitmapImpl_CopyPalette(IMILBitmapSource *iface, + IWICPalette *palette) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + return IWICBitmap_CopyPalette(&This->IWICBitmap_iface, palette); +} + +static HRESULT WINAPI IMILBitmapImpl_CopyPixels(IMILBitmapSource *iface, + const WICRect *rc, UINT stride, UINT size, BYTE *buffer) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + return IWICBitmap_CopyPixels(&This->IWICBitmap_iface, rc, stride, size, buffer); +} + +static HRESULT WINAPI IMILBitmapImpl_UnknownMethod1(IMILBitmapSource *iface, void **ppv) +{ + BitmapImpl *This = impl_from_IMILBitmapSource(iface); + + TRACE("(%p,%p)\n", iface, ppv); + + if (!ppv) return E_INVALIDARG; + + IUnknown_AddRef(&This->IMILUnknown1_iface); + *ppv = &This->IMILUnknown1_iface; + + return S_OK; +} + +static const IMILBitmapSourceVtbl IMILBitmapImpl_Vtbl = +{ + IMILBitmapImpl_QueryInterface, + IMILBitmapImpl_AddRef, + IMILBitmapImpl_Release, + IMILBitmapImpl_GetSize, + IMILBitmapImpl_GetPixelFormat, + IMILBitmapImpl_GetResolution, + IMILBitmapImpl_CopyPalette, + IMILBitmapImpl_CopyPixels, + IMILBitmapImpl_UnknownMethod1, +}; + +static HRESULT WINAPI IMILUnknown1Impl_QueryInterface(IMILUnknown1 *iface, REFIID iid, + void **ppv) +{ + BitmapImpl *This = impl_from_IMILUnknown1(iface); + + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid)) + { + IUnknown_AddRef(&This->IMILUnknown1_iface); + *ppv = iface; + return S_OK; + } + + return IWICBitmap_QueryInterface(&This->IWICBitmap_iface, iid, ppv); +} + +static ULONG WINAPI IMILUnknown1Impl_AddRef(IMILUnknown1 *iface) +{ + BitmapImpl *This = impl_from_IMILUnknown1(iface); + return IWICBitmap_AddRef(&This->IWICBitmap_iface); +} + +static ULONG WINAPI IMILUnknown1Impl_Release(IMILUnknown1 *iface) +{ + BitmapImpl *This = impl_from_IMILUnknown1(iface); + return IWICBitmap_Release(&This->IWICBitmap_iface); +} + +static const IMILUnknown1Vtbl IMILUnknown1Impl_Vtbl = +{ + IMILUnknown1Impl_QueryInterface, + IMILUnknown1Impl_AddRef, + IMILUnknown1Impl_Release, +}; + +static HRESULT WINAPI IMILUnknown2Impl_QueryInterface(IMILUnknown2 *iface, REFIID iid, + void **ppv) +{ + BitmapImpl *This = impl_from_IMILUnknown2(iface); + + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid)) + { + IUnknown_AddRef(&This->IMILUnknown2_iface); + *ppv = iface; + return S_OK; + } + + return IWICBitmap_QueryInterface(&This->IWICBitmap_iface, iid, ppv); +} + +static ULONG WINAPI IMILUnknown2Impl_AddRef(IMILUnknown2 *iface) +{ + BitmapImpl *This = impl_from_IMILUnknown2(iface); + return IWICBitmap_AddRef(&This->IWICBitmap_iface); +} + +static ULONG WINAPI IMILUnknown2Impl_Release(IMILUnknown2 *iface) +{ + BitmapImpl *This = impl_from_IMILUnknown2(iface); + return IWICBitmap_Release(&This->IWICBitmap_iface); +} + +static HRESULT WINAPI IMILUnknown2Impl_UnknownMethod1(IMILUnknown2 *iface, void *arg1, void *arg2) +{ + FIXME("(%p,%p,%p): stub\n", iface, arg1, arg2); + return E_NOTIMPL; +} + +static const IMILUnknown2Vtbl IMILUnknown2Impl_Vtbl = +{ + IMILUnknown2Impl_QueryInterface, + IMILUnknown2Impl_AddRef, + IMILUnknown2Impl_Release, + IMILUnknown2Impl_UnknownMethod1, +}; + HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, UINT stride, UINT datasize, BYTE *bits, REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option, @@ -461,6 +709,9 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, if (bits) memcpy(data, bits, datasize); This->IWICBitmap_iface.lpVtbl = &BitmapImpl_Vtbl; + This->IMILBitmapSource_iface.lpVtbl = &IMILBitmapImpl_Vtbl; + This->IMILUnknown1_iface.lpVtbl = &IMILUnknown1Impl_Vtbl; + This->IMILUnknown2_iface.lpVtbl = &IMILUnknown2Impl_Vtbl; This->ref = 1; This->palette = NULL; This->palette_set = 0; diff --git a/reactos/dll/win32/windowscodecs/bmpdecode.c b/reactos/dll/win32/windowscodecs/bmpdecode.c index dffd4bc2220..5039694a764 100644 --- a/reactos/dll/win32/windowscodecs/bmpdecode.c +++ b/reactos/dll/win32/windowscodecs/bmpdecode.c @@ -1169,17 +1169,15 @@ static HRESULT BmpDecoder_Create(int packed, int icoframe, BmpDecoder **ppDecode return S_OK; } -static HRESULT BmpDecoder_Construct(int packed, int icoframe, IUnknown *pUnkOuter, REFIID iid, void** ppv) +static HRESULT BmpDecoder_Construct(int packed, int icoframe, REFIID iid, void** ppv) { BmpDecoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - ret = BmpDecoder_Create(packed, icoframe, &This); if (FAILED(ret)) return ret; @@ -1189,14 +1187,14 @@ static HRESULT BmpDecoder_Construct(int packed, int icoframe, IUnknown *pUnkOute return ret; } -HRESULT BmpDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT BmpDecoder_CreateInstance(REFIID iid, void** ppv) { - return BmpDecoder_Construct(FALSE, FALSE, pUnkOuter, iid, ppv); + return BmpDecoder_Construct(FALSE, FALSE, iid, ppv); } -HRESULT DibDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT DibDecoder_CreateInstance(REFIID iid, void** ppv) { - return BmpDecoder_Construct(TRUE, FALSE, pUnkOuter, iid, ppv); + return BmpDecoder_Construct(TRUE, FALSE, iid, ppv); } HRESULT IcoDibDecoder_CreateInstance(BmpDecoder **ppDecoder) diff --git a/reactos/dll/win32/windowscodecs/bmpencode.c b/reactos/dll/win32/windowscodecs/bmpencode.c index 774d0d971ba..a30942fb2b4 100644 --- a/reactos/dll/win32/windowscodecs/bmpencode.c +++ b/reactos/dll/win32/windowscodecs/bmpencode.c @@ -586,17 +586,15 @@ static const IWICBitmapEncoderVtbl BmpEncoder_Vtbl = { BmpEncoder_GetMetadataQueryWriter }; -HRESULT BmpEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT BmpEncoder_CreateInstance(REFIID iid, void** ppv) { BmpEncoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(BmpEncoder)); if (!This) return E_OUTOFMEMORY; diff --git a/reactos/dll/win32/windowscodecs/clsfactory.c b/reactos/dll/win32/windowscodecs/clsfactory.c index 0a986c8ce6c..9fb72726fc1 100644 --- a/reactos/dll/win32/windowscodecs/clsfactory.c +++ b/reactos/dll/win32/windowscodecs/clsfactory.c @@ -22,7 +22,7 @@ extern HRESULT WINAPI WIC_DllGetClassObject(REFCLSID, REFIID, LPVOID *) DECLSPEC typedef struct { REFCLSID classid; - HRESULT (*constructor)(IUnknown*,REFIID,void**); + HRESULT (*constructor)(REFIID,void**); } classinfo; static const classinfo wic_classes[] = { @@ -112,7 +112,11 @@ static HRESULT WINAPI ClassFactoryImpl_CreateInstance(IClassFactory *iface, { ClassFactoryImpl *This = impl_from_IClassFactory(iface); - return This->info->constructor(pUnkOuter, riid, ppv); + *ppv = NULL; + + if (pUnkOuter) return CLASS_E_NOAGGREGATION; + + return This->info->constructor(riid, ppv); } static HRESULT WINAPI ClassFactoryImpl_LockServer(IClassFactory *iface, BOOL lock) diff --git a/reactos/dll/win32/windowscodecs/converter.c b/reactos/dll/win32/windowscodecs/converter.c index 5144ee18732..1dcff39fc38 100644 --- a/reactos/dll/win32/windowscodecs/converter.c +++ b/reactos/dll/win32/windowscodecs/converter.c @@ -1256,17 +1256,15 @@ static const IWICFormatConverterVtbl FormatConverter_Vtbl = { FormatConverter_CanConvert }; -HRESULT FormatConverter_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT FormatConverter_CreateInstance(REFIID iid, void** ppv) { FormatConverter *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(FormatConverter)); if (!This) return E_OUTOFMEMORY; diff --git a/reactos/dll/win32/windowscodecs/gifformat.c b/reactos/dll/win32/windowscodecs/gifformat.c index d0cf1a771da..20222d13c4b 100644 --- a/reactos/dll/win32/windowscodecs/gifformat.c +++ b/reactos/dll/win32/windowscodecs/gifformat.c @@ -129,9 +129,9 @@ static const MetadataHandlerVtbl LSDReader_Vtbl = { load_LSD_metadata }; -HRESULT LSDReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) +HRESULT LSDReader_CreateInstance(REFIID iid, void **ppv) { - return MetadataReader_Create(&LSDReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&LSDReader_Vtbl, iid, ppv); } #include "pshpack1.h" @@ -227,9 +227,9 @@ static const MetadataHandlerVtbl IMDReader_Vtbl = { load_IMD_metadata }; -HRESULT IMDReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) +HRESULT IMDReader_CreateInstance(REFIID iid, void **ppv) { - return MetadataReader_Create(&IMDReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&IMDReader_Vtbl, iid, ppv); } static HRESULT load_GCE_metadata(IStream *stream, const GUID *vendor, DWORD options, @@ -305,9 +305,9 @@ static const MetadataHandlerVtbl GCEReader_Vtbl = { load_GCE_metadata }; -HRESULT GCEReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) +HRESULT GCEReader_CreateInstance(REFIID iid, void **ppv) { - return MetadataReader_Create(&GCEReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&GCEReader_Vtbl, iid, ppv); } static HRESULT load_APE_metadata(IStream *stream, const GUID *vendor, DWORD options, @@ -412,9 +412,9 @@ static const MetadataHandlerVtbl APEReader_Vtbl = { load_APE_metadata }; -HRESULT APEReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) +HRESULT APEReader_CreateInstance(REFIID iid, void **ppv) { - return MetadataReader_Create(&APEReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&APEReader_Vtbl, iid, ppv); } static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWORD options, @@ -506,9 +506,9 @@ static const MetadataHandlerVtbl GifCommentReader_Vtbl = { load_GifComment_metadata }; -HRESULT GifCommentReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) +HRESULT GifCommentReader_CreateInstance(REFIID iid, void **ppv) { - return MetadataReader_Create(&GifCommentReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&GifCommentReader_Vtbl, iid, ppv); } static IStream *create_stream(const void *data, int data_size) @@ -1079,7 +1079,7 @@ static int _gif_inputfunc(GifFileType *gif, GifByteType *data, int len) { } hr = IStream_Read(stream, data, len, &bytesread); - if (hr != S_OK) bytesread = 0; + if (FAILED(hr)) bytesread = 0; return bytesread; } @@ -1402,17 +1402,15 @@ static const IWICMetadataBlockReaderVtbl GifDecoder_BlockVtbl = GifDecoder_Block_GetEnumerator }; -HRESULT GifDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT GifDecoder_CreateInstance(REFIID iid, void** ppv) { GifDecoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(GifDecoder)); if (!This) return E_OUTOFMEMORY; diff --git a/reactos/dll/win32/windowscodecs/guid.c b/reactos/dll/win32/windowscodecs/guid.c index 98c8e344554..b3e54f12e44 100644 --- a/reactos/dll/win32/windowscodecs/guid.c +++ b/reactos/dll/win32/windowscodecs/guid.c @@ -16,5 +16,6 @@ DEFINE_GUID(CLSID_WineTgaDecoder, 0xb11fc79a,0x67cc,0x43e6,0xa9,0xce,0xe3,0xd5,0 DEFINE_GUID(CLSID_WICIcnsEncoder, 0x312fb6f1,0xb767,0x409d,0x8a,0x6d,0x0f,0xc1,0x54,0xd4,0xf0,0x5c); DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47,0x3f,0xc1,0x7c,0xd3,0x22); DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a); +DEFINE_GUID(IID_IMILBitmapSource,0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe); /* NO CODE HERE, THIS IS JUST REQUIRED FOR THE GUID DEFINITIONS */ diff --git a/reactos/dll/win32/windowscodecs/icnsformat.c b/reactos/dll/win32/windowscodecs/icnsformat.c index 22dd37b154b..7cad87b7e92 100644 --- a/reactos/dll/win32/windowscodecs/icnsformat.c +++ b/reactos/dll/win32/windowscodecs/icnsformat.c @@ -730,17 +730,15 @@ static const IWICBitmapEncoderVtbl IcnsEncoder_Vtbl = { IcnsEncoder_GetMetadataQueryWriter }; -HRESULT IcnsEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv) { IcnsEncoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(IcnsEncoder)); if (!This) return E_OUTOFMEMORY; @@ -763,7 +761,7 @@ HRESULT IcnsEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) #else /* !defined(HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H) || MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 */ -HRESULT IcnsEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to save ICNS picture, but ICNS support is not compiled in.\n"); return E_FAIL; diff --git a/reactos/dll/win32/windowscodecs/icoformat.c b/reactos/dll/win32/windowscodecs/icoformat.c index ac6fdc70ae8..86629568fd9 100644 --- a/reactos/dll/win32/windowscodecs/icoformat.c +++ b/reactos/dll/win32/windowscodecs/icoformat.c @@ -216,7 +216,7 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result) IWICBitmapFrameDecode *framedecode; WICPixelFormatGUID pixelformat; IWICBitmapSource *source; - int has_alpha=FALSE; /* if TRUE, alpha data might be in the image data */ + BOOL has_alpha=FALSE; /* if TRUE, alpha data might be in the image data */ WICRect rc; hr = IcoDibDecoder_CreateInstance(&bmp_decoder); @@ -381,7 +381,7 @@ static HRESULT ReadIcoPng(IStream *stream, IcoFrameDecode *result) WICRect rect; HRESULT hr; - hr = PngDecoder_CreateInstance(NULL, &IID_IWICBitmapDecoder, (void**)&decoder); + hr = PngDecoder_CreateInstance(&IID_IWICBitmapDecoder, (void**)&decoder); if (FAILED(hr)) goto end; hr = IWICBitmapDecoder_Initialize(decoder, stream, WICDecodeMetadataCacheOnLoad); @@ -722,17 +722,15 @@ static const IWICBitmapDecoderVtbl IcoDecoder_Vtbl = { IcoDecoder_GetFrame }; -HRESULT IcoDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT IcoDecoder_CreateInstance(REFIID iid, void** ppv) { IcoDecoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(IcoDecoder)); if (!This) return E_OUTOFMEMORY; diff --git a/reactos/dll/win32/windowscodecs/imgfactory.c b/reactos/dll/win32/windowscodecs/imgfactory.c index af9aabc9100..b552c7b5a8b 100644 --- a/reactos/dll/win32/windowscodecs/imgfactory.c +++ b/reactos/dll/win32/windowscodecs/imgfactory.c @@ -405,7 +405,7 @@ static HRESULT WINAPI ComponentFactory_CreatePalette(IWICComponentFactory *iface static HRESULT WINAPI ComponentFactory_CreateFormatConverter(IWICComponentFactory *iface, IWICFormatConverter **ppIFormatConverter) { - return FormatConverter_CreateInstance(NULL, &IID_IWICFormatConverter, (void**)ppIFormatConverter); + return FormatConverter_CreateInstance(&IID_IWICFormatConverter, (void**)ppIFormatConverter); } static HRESULT WINAPI ComponentFactory_CreateBitmapScaler(IWICComponentFactory *iface, @@ -585,12 +585,166 @@ static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFacto return BitmapImpl_Create(width, height, stride, size, buffer, format, WICBitmapCacheOnLoad, bitmap); } -static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory *iface, - HBITMAP hBitmap, HPALETTE hPalette, WICBitmapAlphaChannelOption options, - IWICBitmap **ppIBitmap) +static BOOL get_16bpp_format(HBITMAP hbm, WICPixelFormatGUID *format) { - FIXME("(%p,%p,%p,%u,%p): stub\n", iface, hBitmap, hPalette, options, ppIBitmap); - return E_NOTIMPL; + BOOL ret = TRUE; + BITMAPV4HEADER bmh; + HDC hdc; + + hdc = CreateCompatibleDC(0); + + memset(&bmh, 0, sizeof(bmh)); + bmh.bV4Size = sizeof(bmh); + bmh.bV4Width = 1; + bmh.bV4Height = 1; + bmh.bV4V4Compression = BI_BITFIELDS; + bmh.bV4BitCount = 16; + + GetDIBits(hdc, hbm, 0, 0, NULL, (BITMAPINFO *)&bmh, DIB_RGB_COLORS); + + if (bmh.bV4RedMask == 0x7c00 && + bmh.bV4GreenMask == 0x3e0 && + bmh.bV4BlueMask == 0x1f) + { + *format = GUID_WICPixelFormat16bppBGR555; + } + else if (bmh.bV4RedMask == 0xf800 && + bmh.bV4GreenMask == 0x7e0 && + bmh.bV4BlueMask == 0x1f) + { + *format = GUID_WICPixelFormat16bppBGR565; + } + else + { + FIXME("unrecognized bitfields %x,%x,%x\n", bmh.bV4RedMask, + bmh.bV4GreenMask, bmh.bV4BlueMask); + ret = FALSE; + } + + DeleteDC(hdc); + return ret; +} + +static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory *iface, + HBITMAP hbm, HPALETTE hpal, WICBitmapAlphaChannelOption option, IWICBitmap **bitmap) +{ + BITMAP bm; + HRESULT hr; + WICPixelFormatGUID format; + IWICBitmapLock *lock; + UINT size, num_palette_entries = 0; + PALETTEENTRY entry[256]; + + TRACE("(%p,%p,%p,%u,%p)\n", iface, hbm, hpal, option, bitmap); + + if (!bitmap) return E_INVALIDARG; + + if (GetObjectW(hbm, sizeof(bm), &bm) != sizeof(bm)) + return WINCODEC_ERR_WIN32ERROR; + + if (hpal) + { + num_palette_entries = GetPaletteEntries(hpal, 0, 256, entry); + if (!num_palette_entries) + return WINCODEC_ERR_WIN32ERROR; + } + + /* TODO: Figure out the correct format for 16, 32, 64 bpp */ + switch(bm.bmBitsPixel) + { + case 1: + format = GUID_WICPixelFormat1bppIndexed; + break; + case 4: + format = GUID_WICPixelFormat4bppIndexed; + break; + case 8: + format = GUID_WICPixelFormat8bppIndexed; + break; + case 16: + if (!get_16bpp_format(hbm, &format)) + return E_INVALIDARG; + break; + case 24: + format = GUID_WICPixelFormat24bppBGR; + break; + case 32: + switch (option) + { + case WICBitmapUseAlpha: + format = GUID_WICPixelFormat32bppBGRA; + break; + case WICBitmapUsePremultipliedAlpha: + format = GUID_WICPixelFormat32bppPBGRA; + break; + case WICBitmapIgnoreAlpha: + format = GUID_WICPixelFormat32bppBGR; + break; + default: + return E_INVALIDARG; + } + break; + case 48: + format = GUID_WICPixelFormat48bppRGB; + break; + default: + FIXME("unsupported %d bpp\n", bm.bmBitsPixel); + return E_INVALIDARG; + } + + hr = BitmapImpl_Create(bm.bmWidth, bm.bmHeight, bm.bmWidthBytes, 0, NULL, &format, option, bitmap); + if (hr != S_OK) return hr; + + hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock); + if (hr == S_OK) + { + BYTE *buffer; + HDC hdc; + char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)]; + BITMAPINFO *bmi = (BITMAPINFO *)bmibuf; + + IWICBitmapLock_GetDataPointer(lock, &size, &buffer); + + hdc = CreateCompatibleDC(0); + + bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi->bmiHeader.biBitCount = 0; + GetDIBits(hdc, hbm, 0, 0, NULL, bmi, DIB_RGB_COLORS); + bmi->bmiHeader.biHeight = -bm.bmHeight; + GetDIBits(hdc, hbm, 0, bm.bmHeight, buffer, bmi, DIB_RGB_COLORS); + + DeleteDC(hdc); + IWICBitmapLock_Release(lock); + + if (num_palette_entries) + { + IWICPalette *palette; + WICColor colors[256]; + UINT i; + + hr = PaletteImpl_Create(&palette); + if (hr == S_OK) + { + for (i = 0; i < num_palette_entries; i++) + colors[i] = 0xff000000 | entry[i].peRed << 16 | + entry[i].peGreen << 8 | entry[i].peBlue; + + hr = IWICPalette_InitializeCustom(palette, colors, num_palette_entries); + if (hr == S_OK) + hr = IWICBitmap_SetPalette(*bitmap, palette); + + IWICPalette_Release(palette); + } + } + } + + if (hr != S_OK) + { + IWICBitmap_Release(*bitmap); + *bitmap = NULL; + } + + return hr; } static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactory *iface, @@ -860,17 +1014,15 @@ static const IWICComponentFactoryVtbl ComponentFactory_Vtbl = { ComponentFactory_CreateEncoderPropertyBag }; -HRESULT ComponentFactory_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT ComponentFactory_CreateInstance(REFIID iid, void** ppv) { ComponentFactory *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentFactory)); if (!This) return E_OUTOFMEMORY; diff --git a/reactos/dll/win32/windowscodecs/info.c b/reactos/dll/win32/windowscodecs/info.c index 22c62821a23..a020b261e04 100644 --- a/reactos/dll/win32/windowscodecs/info.c +++ b/reactos/dll/win32/windowscodecs/info.c @@ -1754,7 +1754,7 @@ HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo) WCHAR guidstring[39]; LONG res; const struct category *category; - int found=0; + BOOL found = FALSE; HRESULT hr; res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, KEY_READ, &clsidkey); @@ -1775,7 +1775,7 @@ HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo) if (res == ERROR_SUCCESS) { RegCloseKey(classkey); - found = 1; + found = TRUE; } RegCloseKey(instancekey); } diff --git a/reactos/dll/win32/windowscodecs/jpegformat.c b/reactos/dll/win32/windowscodecs/jpegformat.c index 9ecc25b13f3..50ea8c070d5 100644 --- a/reactos/dll/win32/windowscodecs/jpegformat.c +++ b/reactos/dll/win32/windowscodecs/jpegformat.c @@ -231,7 +231,7 @@ static jpeg_boolean source_mgr_fill_input_buffer(j_decompress_ptr cinfo) hr = IStream_Read(This->stream, This->source_buffer, 1024, &bytesread); - if (hr != S_OK || bytesread == 0) + if (FAILED(hr) || bytesread == 0) { return FALSE; } @@ -696,12 +696,12 @@ static const IWICBitmapFrameDecodeVtbl JpegDecoder_Frame_Vtbl = { JpegDecoder_Frame_GetThumbnail }; -HRESULT JpegDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv) { JpegDecoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); if (!libjpeg_handle && !load_libjpeg()) { @@ -711,8 +711,6 @@ HRESULT JpegDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(JpegDecoder)); if (!This) return E_OUTOFMEMORY; @@ -754,13 +752,13 @@ typedef struct JpegEncoder { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; struct jpeg_destination_mgr dest_mgr; - int initialized; + BOOL initialized; int frame_count; - int frame_initialized; - int started_compress; + BOOL frame_initialized; + BOOL started_compress; int lines_written; - int frame_committed; - int committed; + BOOL frame_committed; + BOOL committed; UINT width, height; double xres, yres; const jpeg_compress_format *format; @@ -1031,7 +1029,7 @@ static HRESULT WINAPI JpegEncoder_Frame_WritePixels(IWICBitmapFrameEncode *iface pjpeg_start_compress(&This->cinfo, TRUE); - This->started_compress = 1; + This->started_compress = TRUE; } row_size = This->format->bpp / 8 * This->width; @@ -1438,17 +1436,15 @@ static const IWICBitmapEncoderVtbl JpegEncoder_Vtbl = { JpegEncoder_GetMetadataQueryWriter }; -HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv) { JpegEncoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - if (!libjpeg_handle && !load_libjpeg()) { ERR("Failed writing JPEG because unable to find %s\n",SONAME_LIBJPEG); @@ -1461,13 +1457,13 @@ HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) This->IWICBitmapEncoder_iface.lpVtbl = &JpegEncoder_Vtbl; This->IWICBitmapFrameEncode_iface.lpVtbl = &JpegEncoder_FrameVtbl; This->ref = 1; - This->initialized = 0; + This->initialized = FALSE; This->frame_count = 0; - This->frame_initialized = 0; - This->started_compress = 0; + This->frame_initialized = FALSE; + This->started_compress = FALSE; This->lines_written = 0; - This->frame_committed = 0; - This->committed = 0; + This->frame_committed = FALSE; + This->committed = FALSE; This->width = This->height = 0; This->xres = This->yres = 0.0; This->format = NULL; @@ -1483,13 +1479,13 @@ HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) #else /* !defined(SONAME_LIBJPEG) */ -HRESULT JpegDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to load JPEG picture, but JPEG support is not compiled in.\n"); return E_FAIL; } -HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to save JPEG picture, but JPEG support is not compiled in.\n"); return E_FAIL; diff --git a/reactos/dll/win32/windowscodecs/metadatahandler.c b/reactos/dll/win32/windowscodecs/metadatahandler.c index 66dd2ed84f7..f7239e4ac29 100644 --- a/reactos/dll/win32/windowscodecs/metadatahandler.c +++ b/reactos/dll/win32/windowscodecs/metadatahandler.c @@ -440,7 +440,7 @@ static const IWICPersistStreamVtbl MetadataHandler_PersistStream_Vtbl = { MetadataHandler_SaveEx }; -HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, REFIID iid, void** ppv) { MetadataHandler *This; HRESULT hr; @@ -449,8 +449,6 @@ HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, IUnknown *pUnkO *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(MetadataHandler)); if (!This) return E_OUTOFMEMORY; @@ -709,9 +707,9 @@ static const MetadataHandlerVtbl UnknownMetadataReader_Vtbl = { LoadUnknownMetadata }; -HRESULT UnknownMetadataReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT UnknownMetadataReader_CreateInstance(REFIID iid, void** ppv) { - return MetadataReader_Create(&UnknownMetadataReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&UnknownMetadataReader_Vtbl, iid, ppv); } #define SWAP_USHORT(x) do { if (!native_byte_order) (x) = RtlUshortByteSwap(x); } while(0) @@ -1144,7 +1142,7 @@ static const MetadataHandlerVtbl IfdMetadataReader_Vtbl = { LoadIfdMetadata }; -HRESULT IfdMetadataReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) +HRESULT IfdMetadataReader_CreateInstance(REFIID iid, void **ppv) { - return MetadataReader_Create(&IfdMetadataReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&IfdMetadataReader_Vtbl, iid, ppv); } diff --git a/reactos/dll/win32/windowscodecs/pngformat.c b/reactos/dll/win32/windowscodecs/pngformat.c index 025eff4af11..9fb1acfe4aa 100644 --- a/reactos/dll/win32/windowscodecs/pngformat.c +++ b/reactos/dll/win32/windowscodecs/pngformat.c @@ -129,9 +129,9 @@ static const MetadataHandlerVtbl TextReader_Vtbl = { LoadTextMetadata }; -HRESULT PngTextReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT PngTextReader_CreateInstance(REFIID iid, void** ppv) { - return MetadataReader_Create(&TextReader_Vtbl, pUnkOuter, iid, ppv); + return MetadataReader_Create(&TextReader_Vtbl, iid, ppv); } #ifdef SONAME_LIBPNG @@ -935,7 +935,9 @@ static HRESULT WINAPI PngDecoder_Block_GetContainerFormat(IWICMetadataBlockReade static HRESULT WINAPI PngDecoder_Block_GetCount(IWICMetadataBlockReader *iface, UINT *pcCount) { - FIXME("%p,%p: stub\n", iface, pcCount); + static int once; + TRACE("%p,%p\n", iface, pcCount); + if (!once++) FIXME("stub\n"); return E_NOTIMPL; } @@ -963,17 +965,15 @@ static const IWICMetadataBlockReaderVtbl PngDecoder_BlockVtbl = { PngDecoder_Block_GetEnumerator, }; -HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT PngDecoder_CreateInstance(REFIID iid, void** ppv) { PngDecoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - if (!libpng_handle && !load_libpng()) { ERR("Failed reading PNG because unable to find %s\n",SONAME_LIBPNG); @@ -1655,17 +1655,15 @@ static const IWICBitmapEncoderVtbl PngEncoder_Vtbl = { PngEncoder_GetMetadataQueryWriter }; -HRESULT PngEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT PngEncoder_CreateInstance(REFIID iid, void** ppv) { PngEncoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - if (!libpng_handle && !load_libpng()) { ERR("Failed writing PNG because unable to find %s\n",SONAME_LIBPNG); @@ -1703,13 +1701,13 @@ HRESULT PngEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) #else /* !HAVE_PNG_H */ -HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT PngDecoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to load PNG picture, but PNG support is not compiled in.\n"); return E_FAIL; } -HRESULT PngEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT PngEncoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to save PNG picture, but PNG support is not compiled in.\n"); return E_FAIL; diff --git a/reactos/dll/win32/windowscodecs/proxy.c b/reactos/dll/win32/windowscodecs/proxy.c index 0a2378397e0..1eea7a0ed41 100644 --- a/reactos/dll/win32/windowscodecs/proxy.c +++ b/reactos/dll/win32/windowscodecs/proxy.c @@ -20,6 +20,12 @@ #include "wincodecs_private.h" +HRESULT WINAPI IPropertyBag2_Write_Proxy(IPropertyBag2 *iface, + ULONG cProperties, PROPBAG2 *ppropbag, VARIANT *pvarValue) +{ + return IPropertyBag2_Write(iface, cProperties, ppropbag, pvarValue); +} + HRESULT WINAPI IWICBitmapClipper_Initialize_Proxy_W(IWICBitmapClipper *iface, IWICBitmapSource *pISource, const WICRect *prc) { @@ -614,5 +620,45 @@ HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT SDKVersion, IWICImagingFactory { TRACE("%x, %p\n", SDKVersion, ppIImagingFactory); - return ComponentFactory_CreateInstance(NULL, &IID_IWICImagingFactory, (void**)ppIImagingFactory); + return ComponentFactory_CreateInstance(&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/reactos/dll/win32/windowscodecs/regsvr.c b/reactos/dll/win32/windowscodecs/regsvr.c index da90f1f4d5d..3a6bc60b0b7 100644 --- a/reactos/dll/win32/windowscodecs/regsvr.c +++ b/reactos/dll/win32/windowscodecs/regsvr.c @@ -218,21 +218,21 @@ static HRESULT register_decoders(struct regsvr_decoder const *list) KEY_READ | KEY_WRITE, NULL, &instance_clsid_key, NULL); if (res == ERROR_SUCCESS) { res = RegSetValueExW(instance_clsid_key, clsid_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); RegCloseKey(instance_clsid_key); } if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->author) { res = RegSetValueExA(clsid_key, author_valuename, 0, REG_SZ, - (CONST BYTE*)(list->author), + (const BYTE*)list->author, strlen(list->author) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->friendlyname) { res = RegSetValueExA(clsid_key, friendlyname_valuename, 0, REG_SZ, - (CONST BYTE*)(list->friendlyname), + (const BYTE*)list->friendlyname, strlen(list->friendlyname) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -240,34 +240,34 @@ static HRESULT register_decoders(struct regsvr_decoder const *list) if (list->vendor) { StringFromGUID2(list->vendor, buf, 39); res = RegSetValueExW(clsid_key, vendor_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->container_format) { StringFromGUID2(list->container_format, buf, 39); res = RegSetValueExW(clsid_key, containerformat_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->version) { res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, - (CONST BYTE*)(list->version), + (const BYTE*)list->version, strlen(list->version) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->mimetypes) { res = RegSetValueExA(clsid_key, mimetypes_valuename, 0, REG_SZ, - (CONST BYTE*)(list->mimetypes), + (const BYTE*)list->mimetypes, strlen(list->mimetypes) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->extensions) { res = RegSetValueExA(clsid_key, extensions_valuename, 0, REG_SZ, - (CONST BYTE*)(list->extensions), + (const BYTE*)list->extensions, strlen(list->extensions) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -308,10 +308,10 @@ static HRESULT register_decoders(struct regsvr_decoder const *list) KEY_READ | KEY_WRITE, NULL, &pattern_key, NULL); if (res != ERROR_SUCCESS) break; res = RegSetValueExA(pattern_key, length_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->patterns[i].length), 4); + (const BYTE*)&list->patterns[i].length, 4); if (res == ERROR_SUCCESS) res = RegSetValueExA(pattern_key, position_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->patterns[i].position), 4); + (const BYTE*)&list->patterns[i].position, 4); if (res == ERROR_SUCCESS) res = RegSetValueExA(pattern_key, pattern_valuename, 0, REG_BINARY, list->patterns[i].pattern, @@ -322,7 +322,7 @@ static HRESULT register_decoders(struct regsvr_decoder const *list) list->patterns[i].length); if (res == ERROR_SUCCESS) res = RegSetValueExA(pattern_key, endofstream_valuename, 0, REG_DWORD, - (CONST BYTE*)&(list->patterns[i].endofstream), 4); + (const BYTE*)&list->patterns[i].endofstream, 4); RegCloseKey(pattern_key); } RegCloseKey(patterns_key); @@ -433,21 +433,21 @@ static HRESULT register_encoders(struct regsvr_encoder const *list) KEY_READ | KEY_WRITE, NULL, &instance_clsid_key, NULL); if (res == ERROR_SUCCESS) { res = RegSetValueExW(instance_clsid_key, clsid_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); RegCloseKey(instance_clsid_key); } if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->author) { res = RegSetValueExA(clsid_key, author_valuename, 0, REG_SZ, - (CONST BYTE*)(list->author), + (const BYTE*)list->author, strlen(list->author) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->friendlyname) { res = RegSetValueExA(clsid_key, friendlyname_valuename, 0, REG_SZ, - (CONST BYTE*)(list->friendlyname), + (const BYTE*)list->friendlyname, strlen(list->friendlyname) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -455,34 +455,34 @@ static HRESULT register_encoders(struct regsvr_encoder const *list) if (list->vendor) { StringFromGUID2(list->vendor, buf, 39); res = RegSetValueExW(clsid_key, vendor_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->container_format) { StringFromGUID2(list->container_format, buf, 39); res = RegSetValueExW(clsid_key, containerformat_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->version) { res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, - (CONST BYTE*)(list->version), + (const BYTE*)list->version, strlen(list->version) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->mimetypes) { res = RegSetValueExA(clsid_key, mimetypes_valuename, 0, REG_SZ, - (CONST BYTE*)(list->mimetypes), + (const BYTE*)list->mimetypes, strlen(list->mimetypes) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->extensions) { res = RegSetValueExA(clsid_key, extensions_valuename, 0, REG_SZ, - (CONST BYTE*)(list->extensions), + (const BYTE*)list->extensions, strlen(list->extensions) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -611,21 +611,21 @@ static HRESULT register_converters(struct regsvr_converter const *list) KEY_READ | KEY_WRITE, NULL, &instance_clsid_key, NULL); if (res == ERROR_SUCCESS) { res = RegSetValueExW(instance_clsid_key, clsid_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); RegCloseKey(instance_clsid_key); } if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->author) { res = RegSetValueExA(clsid_key, author_valuename, 0, REG_SZ, - (CONST BYTE*)(list->author), + (const BYTE*)list->author, strlen(list->author) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->friendlyname) { res = RegSetValueExA(clsid_key, friendlyname_valuename, 0, REG_SZ, - (CONST BYTE*)(list->friendlyname), + (const BYTE*)list->friendlyname, strlen(list->friendlyname) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -633,13 +633,13 @@ static HRESULT register_converters(struct regsvr_converter const *list) if (list->vendor) { StringFromGUID2(list->vendor, buf, 39); res = RegSetValueExW(clsid_key, vendor_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->version) { res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, - (CONST BYTE*)(list->version), + (const BYTE*)list->version, strlen(list->version) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -768,21 +768,21 @@ static HRESULT register_metadatareaders(struct regsvr_metadatareader const *list KEY_READ | KEY_WRITE, NULL, &instance_clsid_key, NULL); if (res == ERROR_SUCCESS) { res = RegSetValueExW(instance_clsid_key, clsid_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); RegCloseKey(instance_clsid_key); } if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->author) { res = RegSetValueExA(clsid_key, author_valuename, 0, REG_SZ, - (CONST BYTE*)(list->author), + (const BYTE*)list->author, strlen(list->author) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->friendlyname) { res = RegSetValueExA(clsid_key, friendlyname_valuename, 0, REG_SZ, - (CONST BYTE*)(list->friendlyname), + (const BYTE*)list->friendlyname, strlen(list->friendlyname) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -790,42 +790,42 @@ static HRESULT register_metadatareaders(struct regsvr_metadatareader const *list if (list->vendor) { StringFromGUID2(list->vendor, buf, 39); res = RegSetValueExW(clsid_key, vendor_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->metadata_format) { StringFromGUID2(list->metadata_format, buf, 39); res = RegSetValueExW(clsid_key, metadataformat_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->version) { res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, - (CONST BYTE*)(list->version), + (const BYTE*)list->version, strlen(list->version) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->specversion) { res = RegSetValueExA(clsid_key, specversion_valuename, 0, REG_SZ, - (CONST BYTE*)(list->version), + (const BYTE*)list->version, strlen(list->version) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } res = RegSetValueExA(clsid_key, requiresfullstream_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->requires_fullstream), 4); + (const BYTE*)&list->requires_fullstream, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; res = RegSetValueExA(clsid_key, supportspadding_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->supports_padding), 4); + (const BYTE*)&list->supports_padding, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->requires_fixedsize) { res = RegSetValueExA(clsid_key, requiresfixedsize_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->requires_fixedsize), 4); + (const BYTE*)&list->requires_fixedsize, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -854,7 +854,7 @@ static HRESULT register_metadatareaders(struct regsvr_metadatareader const *list KEY_READ | KEY_WRITE, NULL, &pattern_key, NULL); if (res != ERROR_SUCCESS) break; res = RegSetValueExA(pattern_key, position_valuename, 0, REG_DWORD, - (CONST BYTE*)(&container->patterns[i].position), 4); + (const BYTE*)&container->patterns[i].position, 4); if (res == ERROR_SUCCESS) res = RegSetValueExA(pattern_key, pattern_valuename, 0, REG_BINARY, container->patterns[i].pattern, @@ -865,7 +865,7 @@ static HRESULT register_metadatareaders(struct regsvr_metadatareader const *list container->patterns[i].length); if (res == ERROR_SUCCESS && container->patterns[i].data_offset) res = RegSetValueExA(pattern_key, dataoffset_valuename, 0, REG_DWORD, - (CONST BYTE*)&(container->patterns[i].data_offset), 4); + (const BYTE*)&container->patterns[i].data_offset, 4); RegCloseKey(pattern_key); } @@ -978,21 +978,21 @@ static HRESULT register_pixelformats(struct regsvr_pixelformat const *list) KEY_READ | KEY_WRITE, NULL, &instance_clsid_key, NULL); if (res == ERROR_SUCCESS) { res = RegSetValueExW(instance_clsid_key, clsid_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); RegCloseKey(instance_clsid_key); } if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->author) { res = RegSetValueExA(clsid_key, author_valuename, 0, REG_SZ, - (CONST BYTE*)(list->author), + (const BYTE*)list->author, strlen(list->author) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->friendlyname) { res = RegSetValueExA(clsid_key, friendlyname_valuename, 0, REG_SZ, - (CONST BYTE*)(list->friendlyname), + (const BYTE*)list->friendlyname, strlen(list->friendlyname) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } @@ -1000,31 +1000,31 @@ static HRESULT register_pixelformats(struct regsvr_pixelformat const *list) if (list->vendor) { StringFromGUID2(list->vendor, buf, 39); res = RegSetValueExW(clsid_key, vendor_valuename, 0, REG_SZ, - (CONST BYTE*)(buf), 78); + (const BYTE*)buf, 78); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } if (list->version) { res = RegSetValueExA(clsid_key, version_valuename, 0, REG_SZ, - (CONST BYTE*)(list->version), + (const BYTE*)list->version, strlen(list->version) + 1); if (res != ERROR_SUCCESS) goto error_close_clsid_key; } res = RegSetValueExA(clsid_key, bitsperpixel_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->bitsperpixel), 4); + (const BYTE*)&list->bitsperpixel, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; res = RegSetValueExA(clsid_key, channelcount_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->channelcount), 4); + (const BYTE*)&list->channelcount, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; res = RegSetValueExA(clsid_key, numericrepresentation_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->numericrepresentation), 4); + (const BYTE*)&list->numericrepresentation, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; res = RegSetValueExA(clsid_key, supportstransparency_valuename, 0, REG_DWORD, - (CONST BYTE*)(&list->supportsalpha), 4); + (const BYTE*)&list->supportsalpha, 4); if (res != ERROR_SUCCESS) goto error_close_clsid_key; if (list->channelmasks) { diff --git a/reactos/dll/win32/windowscodecs/tgaformat.c b/reactos/dll/win32/windowscodecs/tgaformat.c index 03fd653ae4e..6b7c71fdbdd 100644 --- a/reactos/dll/win32/windowscodecs/tgaformat.c +++ b/reactos/dll/win32/windowscodecs/tgaformat.c @@ -934,17 +934,15 @@ static const IWICBitmapFrameDecodeVtbl TgaDecoder_Frame_Vtbl = { TgaDecoder_Frame_GetThumbnail }; -HRESULT TgaDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT TgaDecoder_CreateInstance(REFIID iid, void** ppv) { TgaDecoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - This = HeapAlloc(GetProcessHeap(), 0, sizeof(TgaDecoder)); if (!This) return E_OUTOFMEMORY; diff --git a/reactos/dll/win32/windowscodecs/tiffformat.c b/reactos/dll/win32/windowscodecs/tiffformat.c index 03771662fec..3f48033d5b8 100644 --- a/reactos/dll/win32/windowscodecs/tiffformat.c +++ b/reactos/dll/win32/windowscodecs/tiffformat.c @@ -1279,17 +1279,15 @@ static const IWICMetadataBlockReaderVtbl TiffFrameDecode_BlockVtbl = TiffFrameDecode_Block_GetEnumerator }; -HRESULT TiffDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv) { HRESULT ret; TiffDecoder *This; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - if (!load_libtiff()) { ERR("Failed reading TIFF because unable to load %s\n",SONAME_LIBTIFF); @@ -2023,17 +2021,15 @@ static const IWICBitmapEncoderVtbl TiffEncoder_Vtbl = { TiffEncoder_GetMetadataQueryWriter }; -HRESULT TiffEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv) { TiffEncoder *This; HRESULT ret; - TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv); + TRACE("(%s,%p)\n", debugstr_guid(iid), ppv); *ppv = NULL; - if (pUnkOuter) return CLASS_E_NOAGGREGATION; - if (!load_libtiff()) { ERR("Failed writing TIFF because unable to load %s\n",SONAME_LIBTIFF); @@ -2062,13 +2058,13 @@ HRESULT TiffEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) #else /* !SONAME_LIBTIFF */ -HRESULT TiffDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to load TIFF picture, but Wine was compiled without TIFF support.\n"); return E_FAIL; } -HRESULT TiffEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) +HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv) { ERR("Trying to save TIFF picture, but Wine was compiled without TIFF support.\n"); return E_FAIL; diff --git a/reactos/dll/win32/windowscodecs/wincodecs_private.h b/reactos/dll/win32/windowscodecs/wincodecs_private.h index 7d4d198b191..c6a5d9fd56f 100644 --- a/reactos/dll/win32/windowscodecs/wincodecs_private.h +++ b/reactos/dll/win32/windowscodecs/wincodecs_private.h @@ -54,22 +54,61 @@ DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47 DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a); -extern HRESULT FormatConverter_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT ComponentFactory_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT BmpDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT PngEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT BmpEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT DibDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT GifDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT IcoDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT JpegDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT TiffDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT TiffEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT IcnsEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; +DEFINE_GUID(IID_IMILBitmapSource,0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe); +#define INTERFACE IMILBitmapSource +DECLARE_INTERFACE_(IMILBitmapSource,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IMILBitmapSource methods ***/ + STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *); + STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *); + STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *); + STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *); + STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *); + STDMETHOD_(HRESULT,UnknownMethod1)(THIS_ void **); +}; +#undef INTERFACE -extern HRESULT TgaDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; +#define INTERFACE IMILUnknown1 +DECLARE_INTERFACE_(IMILUnknown1,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; +}; +#undef INTERFACE + +#define INTERFACE IMILUnknown2 +DECLARE_INTERFACE_(IMILUnknown2,IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** unknown methods ***/ + STDMETHOD_(HRESULT,UnknownMethod1)(THIS_ void *, void *) PURE; +}; +#undef INTERFACE + +extern HRESULT FormatConverter_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT ComponentFactory_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT BmpDecoder_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT PngDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT PngEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT BmpEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT DibDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT GifDecoder_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT IcoDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT TgaDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; extern HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, UINT stride, UINT datasize, BYTE *bits, @@ -122,16 +161,16 @@ typedef struct _MetadataHandlerVtbl ULARGE_INTEGER *size); } MetadataHandlerVtbl; -extern HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT UnknownMetadataReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT IfdMetadataReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; -extern HRESULT PngTextReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) DECLSPEC_HIDDEN; -extern HRESULT LSDReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; -extern HRESULT IMDReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; -extern HRESULT GCEReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; -extern HRESULT APEReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; -extern HRESULT GifCommentReader_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT UnknownMetadataReader_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT IfdMetadataReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT PngTextReader_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN; +extern HRESULT LSDReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT IMDReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT GCEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT APEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; +extern HRESULT GifCommentReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN; extern HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE hfile) DECLSPEC_HIDDEN; diff --git a/reactos/dll/win32/windowscodecs/windowscodecs.spec b/reactos/dll/win32/windowscodecs/windowscodecs.spec index 5250bea23d3..289525c32a8 100644 --- a/reactos/dll/win32/windowscodecs/windowscodecs.spec +++ b/reactos/dll/win32/windowscodecs/windowscodecs.spec @@ -4,7 +4,7 @@ @ stdcall -private DllUnregisterServer() @ stub IEnumString_Next_WIC_Proxy @ stub IEnumString_Reset_WIC_Proxy -@ stub IPropertyBag2_Write_Proxy +@ stdcall IPropertyBag2_Write_Proxy(ptr long ptr ptr) @ stdcall IWICBitmapClipper_Initialize_Proxy(ptr ptr ptr) IWICBitmapClipper_Initialize_Proxy_W @ stdcall IWICBitmapCodecInfo_DoesSupportAnimation_Proxy(ptr ptr) IWICBitmapCodecInfo_DoesSupportAnimation_Proxy_W @ stdcall IWICBitmapCodecInfo_DoesSupportLossless_Proxy(ptr ptr) IWICBitmapCodecInfo_DoesSupportLossless_Proxy_W @@ -114,4 +114,4 @@ @ stub WICMapShortNameToGuid @ stub WICMatchMetadataContent @ stub WICSerializeMetadataContent -@ stub WICSetEncoderFormat_Proxy +@ stdcall WICSetEncoderFormat_Proxy(ptr ptr ptr ptr) diff --git a/reactos/dll/win32/windowscodecs/windowscodecs_wincodec.idl b/reactos/dll/win32/windowscodecs/windowscodecs_wincodec.idl index 658ced08e72..489d74bc5c7 100644 --- a/reactos/dll/win32/windowscodecs/windowscodecs_wincodec.idl +++ b/reactos/dll/win32/windowscodecs/windowscodecs_wincodec.idl @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#pragma makedep proxy +#pragma makedep register + #include "wincodec.idl" [ diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 2ed40a33645..f2ffcd4405a 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -203,7 +203,7 @@ reactos/dll/win32/version # Synced to Wine-1.7.1 reactos/dll/win32/wbemdisp # Synced to Wine-1.7.17 reactos/dll/win32/wbemprox # Synced to Wine-1.7.2 reactos/dll/win32/wer # Autosync -reactos/dll/win32/windowscodecs # Synced to Wine-1.7.1 +reactos/dll/win32/windowscodecs # Synced to Wine-1.7.17 reactos/dll/win32/windowscodecsext # Synced to Wine-1.7.1 reactos/dll/win32/winemp3.acm # Synced to Wine-1.7.1 reactos/dll/win32/wing32 # Out of sync