[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-devel
Subject: [v2 PATCH 1/2] wincodecs: Add IWICImagingFactory2 stub.
From: Nikolay Sivov <nsivov () codeweavers ! com>
Date: 2018-09-30 11:05:56
Message-ID: 20180930110557.6251-1-nsivov () codeweavers ! com
[Download RAW message or body]
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
---
dlls/windowscodecs/clsfactory.c | 3 +-
dlls/windowscodecs/imgfactory.c | 330 +++++++++++++++++++++----
dlls/windowscodecs/pngformat.c | 2 +-
dlls/windowscodecs/proxy.c | 2 +-
dlls/windowscodecs/tests/info.c | 33 +++
dlls/windowscodecs/wincodecs_private.h | 2 +-
6 files changed, 322 insertions(+), 50 deletions(-)
diff --git a/dlls/windowscodecs/clsfactory.c b/dlls/windowscodecs/clsfactory.c
index 77eeedc428..32083a2a3f 100644
--- a/dlls/windowscodecs/clsfactory.c
+++ b/dlls/windowscodecs/clsfactory.c
@@ -43,7 +43,8 @@ typedef struct {
} classinfo;
static const classinfo wic_classes[] = {
- {&CLSID_WICImagingFactory, ComponentFactory_CreateInstance},
+ {&CLSID_WICImagingFactory, ImagingFactory_CreateInstance},
+ {&CLSID_WICImagingFactory2, ImagingFactory_CreateInstance},
{&CLSID_WICBmpDecoder, BmpDecoder_CreateInstance},
{&CLSID_WICPngDecoder, PngDecoder_CreateInstance},
{&CLSID_WICPngEncoder, PngEncoder_CreateInstance},
diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c
index 06e3f6aceb..dbcc5f5923 100644
--- a/dlls/windowscodecs/imgfactory.c
+++ b/dlls/windowscodecs/imgfactory.c
@@ -36,19 +36,25 @@
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
typedef struct {
+ IWICImagingFactory2 IWICImagingFactory2_iface;
IWICComponentFactory IWICComponentFactory_iface;
LONG ref;
-} ComponentFactory;
+} ImagingFactory;
-static inline ComponentFactory *impl_from_IWICComponentFactory(IWICComponentFactory \
*iface) +static inline ImagingFactory \
*impl_from_IWICComponentFactory(IWICComponentFactory *iface) {
- return CONTAINING_RECORD(iface, ComponentFactory, IWICComponentFactory_iface);
+ return CONTAINING_RECORD(iface, ImagingFactory, IWICComponentFactory_iface);
}
-static HRESULT WINAPI ComponentFactory_QueryInterface(IWICComponentFactory *iface, \
REFIID iid, +static inline ImagingFactory \
*impl_from_IWICImagingFactory2(IWICImagingFactory2 *iface) +{
+ return CONTAINING_RECORD(iface, ImagingFactory, IWICImagingFactory2_iface);
+}
+
+static HRESULT WINAPI ImagingFactory_QueryInterface(IWICImagingFactory2 *iface, \
REFIID iid, void **ppv)
{
- ComponentFactory *This = impl_from_IWICComponentFactory(iface);
+ ImagingFactory *This = impl_from_IWICImagingFactory2(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
if (!ppv) return E_INVALIDARG;
@@ -59,6 +65,10 @@ static HRESULT WINAPI \
ComponentFactory_QueryInterface(IWICComponentFactory *ifac {
*ppv = &This->IWICComponentFactory_iface;
}
+ else if (IsEqualIID(&IID_IWICImagingFactory2, iid))
+ {
+ *ppv = &This->IWICImagingFactory2_iface;
+ }
else
{
*ppv = NULL;
@@ -69,9 +79,9 @@ static HRESULT WINAPI \
ComponentFactory_QueryInterface(IWICComponentFactory *ifac return S_OK;
}
-static ULONG WINAPI ComponentFactory_AddRef(IWICComponentFactory *iface)
+static ULONG WINAPI ImagingFactory_AddRef(IWICImagingFactory2 *iface)
{
- ComponentFactory *This = impl_from_IWICComponentFactory(iface);
+ ImagingFactory *This = impl_from_IWICImagingFactory2(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref);
@@ -79,9 +89,9 @@ static ULONG WINAPI ComponentFactory_AddRef(IWICComponentFactory \
*iface) return ref;
}
-static ULONG WINAPI ComponentFactory_Release(IWICComponentFactory *iface)
+static ULONG WINAPI ImagingFactory_Release(IWICImagingFactory2 *iface)
{
- ComponentFactory *This = impl_from_IWICComponentFactory(iface);
+ ImagingFactory *This = impl_from_IWICImagingFactory2(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref);
@@ -92,8 +102,8 @@ static ULONG WINAPI ComponentFactory_Release(IWICComponentFactory \
*iface) return ref;
}
-static HRESULT WINAPI ComponentFactory_CreateDecoderFromFilename(
- IWICComponentFactory *iface, LPCWSTR wzFilename, const GUID *pguidVendor,
+static HRESULT WINAPI ImagingFactory_CreateDecoderFromFilename(
+ IWICImagingFactory2 *iface, LPCWSTR wzFilename, const GUID *pguidVendor,
DWORD dwDesiredAccess, WICDecodeOptions metadataOptions,
IWICBitmapDecoder **ppIDecoder)
{
@@ -110,7 +120,7 @@ static HRESULT WINAPI ComponentFactory_CreateDecoderFromFilename(
if (SUCCEEDED(hr))
{
- hr = IWICComponentFactory_CreateDecoderFromStream(iface, \
(IStream*)stream, + hr = \
IWICImagingFactory2_CreateDecoderFromStream(iface, (IStream*)stream, pguidVendor, \
metadataOptions, ppIDecoder); }
@@ -190,8 +200,8 @@ static IWICBitmapDecoder *find_decoder(IStream *pIStream, const \
GUID *pguidVendo return decoder;
}
-static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream(
- IWICComponentFactory *iface, IStream *pIStream, const GUID *pguidVendor,
+static HRESULT WINAPI ImagingFactory_CreateDecoderFromStream(
+ IWICImagingFactory2 *iface, IStream *pIStream, const GUID *pguidVendor,
WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
{
HRESULT res;
@@ -232,8 +242,8 @@ static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream(
}
}
-static HRESULT WINAPI ComponentFactory_CreateDecoderFromFileHandle(
- IWICComponentFactory *iface, ULONG_PTR hFile, const GUID *pguidVendor,
+static HRESULT WINAPI ImagingFactory_CreateDecoderFromFileHandle(
+ IWICImagingFactory2 *iface, ULONG_PTR hFile, const GUID *pguidVendor,
WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
{
IWICStream *stream;
@@ -248,7 +258,7 @@ static HRESULT WINAPI \
ComponentFactory_CreateDecoderFromFileHandle( hr = \
stream_initialize_from_filehandle(stream, (HANDLE)hFile); if (SUCCEEDED(hr))
{
- hr = IWICComponentFactory_CreateDecoderFromStream(iface, \
(IStream*)stream, + hr = \
IWICImagingFactory2_CreateDecoderFromStream(iface, (IStream*)stream, pguidVendor, \
metadataOptions, ppIDecoder); }
IWICStream_Release(stream);
@@ -256,14 +266,14 @@ static HRESULT WINAPI \
ComponentFactory_CreateDecoderFromFileHandle( return hr;
}
-static HRESULT WINAPI ComponentFactory_CreateComponentInfo(IWICComponentFactory \
*iface, +static HRESULT WINAPI ImagingFactory_CreateComponentInfo(IWICImagingFactory2 \
*iface, REFCLSID clsidComponent, IWICComponentInfo **ppIInfo)
{
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(clsidComponent), ppIInfo);
return CreateComponentInfo(clsidComponent, ppIInfo);
}
-static HRESULT WINAPI ComponentFactory_CreateDecoder(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateDecoder(IWICImagingFactory2 *iface,
REFGUID guidContainerFormat, const GUID *pguidVendor,
IWICBitmapDecoder **ppIDecoder)
{
@@ -346,7 +356,7 @@ static HRESULT WINAPI \
ComponentFactory_CreateDecoder(IWICComponentFactory *iface return \
WINCODEC_ERR_COMPONENTNOTFOUND; }
-static HRESULT WINAPI ComponentFactory_CreateEncoder(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateEncoder(IWICImagingFactory2 *iface,
REFGUID guidContainerFormat, const GUID *pguidVendor,
IWICBitmapEncoder **ppIEncoder)
{
@@ -411,20 +421,20 @@ static HRESULT WINAPI \
ComponentFactory_CreateEncoder(IWICComponentFactory *iface }
}
-static HRESULT WINAPI ComponentFactory_CreatePalette(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreatePalette(IWICImagingFactory2 *iface,
IWICPalette **ppIPalette)
{
TRACE("(%p,%p)\n", iface, ppIPalette);
return PaletteImpl_Create(ppIPalette);
}
-static HRESULT WINAPI ComponentFactory_CreateFormatConverter(IWICComponentFactory \
*iface, +static HRESULT WINAPI \
ImagingFactory_CreateFormatConverter(IWICImagingFactory2 *iface, IWICFormatConverter \
**ppIFormatConverter) {
return FormatConverter_CreateInstance(&IID_IWICFormatConverter, \
(void**)ppIFormatConverter); }
-static HRESULT WINAPI ComponentFactory_CreateBitmapScaler(IWICComponentFactory \
*iface, +static HRESULT WINAPI ImagingFactory_CreateBitmapScaler(IWICImagingFactory2 \
*iface, IWICBitmapScaler **ppIBitmapScaler)
{
TRACE("(%p,%p)\n", iface, ppIBitmapScaler);
@@ -432,42 +442,42 @@ static HRESULT WINAPI \
ComponentFactory_CreateBitmapScaler(IWICComponentFactory * return \
BitmapScaler_Create(ppIBitmapScaler); }
-static HRESULT WINAPI ComponentFactory_CreateBitmapClipper(IWICComponentFactory \
*iface, +static HRESULT WINAPI ImagingFactory_CreateBitmapClipper(IWICImagingFactory2 \
*iface, IWICBitmapClipper **ppIBitmapClipper)
{
TRACE("(%p,%p)\n", iface, ppIBitmapClipper);
return BitmapClipper_Create(ppIBitmapClipper);
}
-static HRESULT WINAPI ComponentFactory_CreateBitmapFlipRotator(IWICComponentFactory \
*iface, +static HRESULT WINAPI \
ImagingFactory_CreateBitmapFlipRotator(IWICImagingFactory2 *iface, \
IWICBitmapFlipRotator **ppIBitmapFlipRotator) {
TRACE("(%p,%p)\n", iface, ppIBitmapFlipRotator);
return FlipRotator_Create(ppIBitmapFlipRotator);
}
-static HRESULT WINAPI ComponentFactory_CreateStream(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateStream(IWICImagingFactory2 *iface,
IWICStream **ppIWICStream)
{
TRACE("(%p,%p)\n", iface, ppIWICStream);
return StreamImpl_Create(ppIWICStream);
}
-static HRESULT WINAPI ComponentFactory_CreateColorContext(IWICComponentFactory \
*iface, +static HRESULT WINAPI ImagingFactory_CreateColorContext(IWICImagingFactory2 \
*iface, IWICColorContext **ppIColorContext)
{
TRACE("(%p,%p)\n", iface, ppIColorContext);
return ColorContext_Create(ppIColorContext);
}
-static HRESULT WINAPI ComponentFactory_CreateColorTransformer(IWICComponentFactory \
*iface, +static HRESULT WINAPI \
ImagingFactory_CreateColorTransformer(IWICImagingFactory2 *iface, IWICColorTransform \
**ppIColorTransform) {
TRACE("(%p,%p)\n", iface, ppIColorTransform);
return ColorTransform_Create(ppIColorTransform);
}
-static HRESULT WINAPI ComponentFactory_CreateBitmap(IWICComponentFactory *iface,
+static HRESULT WINAPI ImagingFactory_CreateBitmap(IWICImagingFactory2 *iface,
UINT uiWidth, UINT uiHeight, REFWICPixelFormatGUID pixelFormat,
WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
{
@@ -476,7 +486,7 @@ static HRESULT WINAPI \
ComponentFactory_CreateBitmap(IWICComponentFactory *iface,
return BitmapImpl_Create(uiWidth, uiHeight, 0, 0, NULL, 0, pixelFormat, option, \
ppIBitmap); }
-static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource(IWICComponentFactory \
*iface, +static HRESULT WINAPI \
ImagingFactory_CreateBitmapFromSource(IWICImagingFactory2 *iface, IWICBitmapSource \
*piBitmapSource, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
{
@@ -582,7 +592,7 @@ static HRESULT WINAPI \
ComponentFactory_CreateBitmapFromSource(IWICComponentFacto return hr;
}
-static HRESULT WINAPI \
ComponentFactory_CreateBitmapFromSourceRect(IWICComponentFactory *iface, +static \
HRESULT WINAPI \
ImagingFactory_CreateBitmapFromSourceRect(IWICImagingFactory2 *iface,
IWICBitmapSource *piBitmapSource, UINT x, UINT y, UINT width, UINT height,
IWICBitmap **ppIBitmap)
{
@@ -591,7 +601,7 @@ static HRESULT WINAPI \
ComponentFactory_CreateBitmapFromSourceRect(IWICComponentF return E_NOTIMPL;
}
-static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFactory \
*iface, +static HRESULT WINAPI \
ImagingFactory_CreateBitmapFromMemory(IWICImagingFactory2 *iface, UINT width, UINT \
height, REFWICPixelFormatGUID format, UINT stride, UINT size, BYTE *buffer, \
IWICBitmap **bitmap) {
@@ -667,7 +677,7 @@ static BOOL get_16bpp_format(HBITMAP hbm, WICPixelFormatGUID \
*format) return ret;
}
-static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory \
*iface, +static HRESULT WINAPI \
ImagingFactory_CreateBitmapFromHBITMAP(IWICImagingFactory2 *iface,
HBITMAP hbm, HPALETTE hpal, WICBitmapAlphaChannelOption option, IWICBitmap \
**bitmap) {
BITMAP bm;
@@ -790,7 +800,7 @@ static HRESULT WINAPI \
ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFact return hr;
}
-static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactory \
*iface, +static HRESULT WINAPI \
ImagingFactory_CreateBitmapFromHICON(IWICImagingFactory2 *iface, HICON hicon, \
IWICBitmap **bitmap) {
IWICBitmapLock *lock;
@@ -927,30 +937,30 @@ failed:
return hr;
}
-static HRESULT WINAPI \
ComponentFactory_CreateComponentEnumerator(IWICComponentFactory *iface, +static \
HRESULT WINAPI ImagingFactory_CreateComponentEnumerator(IWICImagingFactory2 *iface, \
DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown) {
TRACE("(%p,%u,%u,%p)\n", iface, componentTypes, options, ppIEnumUnknown);
return CreateComponentEnumerator(componentTypes, options, ppIEnumUnknown);
}
-static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromDecoder(
- IWICComponentFactory *iface, IWICBitmapDecoder *pIDecoder,
+static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromDecoder(
+ IWICImagingFactory2 *iface, IWICBitmapDecoder *pIDecoder,
IWICFastMetadataEncoder **ppIFastEncoder)
{
FIXME("(%p,%p,%p): stub\n", iface, pIDecoder, ppIFastEncoder);
return E_NOTIMPL;
}
-static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromFrameDecode(
- IWICComponentFactory *iface, IWICBitmapFrameDecode *pIFrameDecoder,
+static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromFrameDecode(
+ IWICImagingFactory2 *iface, IWICBitmapFrameDecode *pIFrameDecoder,
IWICFastMetadataEncoder **ppIFastEncoder)
{
FIXME("(%p,%p,%p): stub\n", iface, pIFrameDecoder, ppIFastEncoder);
return E_NOTIMPL;
}
-static HRESULT WINAPI ComponentFactory_CreateQueryWriter(IWICComponentFactory \
*iface, +static HRESULT WINAPI ImagingFactory_CreateQueryWriter(IWICImagingFactory2 \
*iface, REFGUID guidMetadataFormat, const GUID *pguidVendor,
IWICMetadataQueryWriter **ppIQueryWriter)
{
@@ -959,7 +969,7 @@ static HRESULT WINAPI \
ComponentFactory_CreateQueryWriter(IWICComponentFactory *i return E_NOTIMPL;
}
-static HRESULT WINAPI \
ComponentFactory_CreateQueryWriterFromReader(IWICComponentFactory *iface, +static \
HRESULT WINAPI ImagingFactory_CreateQueryWriterFromReader(IWICImagingFactory2 *iface, \
IWICMetadataQueryReader *pIQueryReader, const GUID *pguidVendor, \
IWICMetadataQueryWriter **ppIQueryWriter) {
@@ -968,6 +978,233 @@ static HRESULT WINAPI \
ComponentFactory_CreateQueryWriterFromReader(IWICComponent return E_NOTIMPL;
}
+static HRESULT WINAPI ImagingFactory_CreateImageEncoder(IWICImagingFactory2 *iface, \
ID2D1Device *device, IWICImageEncoder **encoder) +{
+ FIXME("%p,%p,%p stub.\n", iface, device, encoder);
+ return E_NOTIMPL;
+}
+
+static const IWICImagingFactory2Vtbl ImagingFactory_Vtbl = {
+ ImagingFactory_QueryInterface,
+ ImagingFactory_AddRef,
+ ImagingFactory_Release,
+ ImagingFactory_CreateDecoderFromFilename,
+ ImagingFactory_CreateDecoderFromStream,
+ ImagingFactory_CreateDecoderFromFileHandle,
+ ImagingFactory_CreateComponentInfo,
+ ImagingFactory_CreateDecoder,
+ ImagingFactory_CreateEncoder,
+ ImagingFactory_CreatePalette,
+ ImagingFactory_CreateFormatConverter,
+ ImagingFactory_CreateBitmapScaler,
+ ImagingFactory_CreateBitmapClipper,
+ ImagingFactory_CreateBitmapFlipRotator,
+ ImagingFactory_CreateStream,
+ ImagingFactory_CreateColorContext,
+ ImagingFactory_CreateColorTransformer,
+ ImagingFactory_CreateBitmap,
+ ImagingFactory_CreateBitmapFromSource,
+ ImagingFactory_CreateBitmapFromSourceRect,
+ ImagingFactory_CreateBitmapFromMemory,
+ ImagingFactory_CreateBitmapFromHBITMAP,
+ ImagingFactory_CreateBitmapFromHICON,
+ ImagingFactory_CreateComponentEnumerator,
+ ImagingFactory_CreateFastMetadataEncoderFromDecoder,
+ ImagingFactory_CreateFastMetadataEncoderFromFrameDecode,
+ ImagingFactory_CreateQueryWriter,
+ ImagingFactory_CreateQueryWriterFromReader,
+ ImagingFactory_CreateImageEncoder,
+};
+
+static HRESULT WINAPI ComponentFactory_QueryInterface(IWICComponentFactory *iface, \
REFIID iid, void **ppv) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_QueryInterface(&This->IWICImagingFactory2_iface, iid, \
ppv); +}
+
+static ULONG WINAPI ComponentFactory_AddRef(IWICComponentFactory *iface)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_AddRef(&This->IWICImagingFactory2_iface);
+}
+
+static ULONG WINAPI ComponentFactory_Release(IWICComponentFactory *iface)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_Release(&This->IWICImagingFactory2_iface);
+}
+
+static HRESULT WINAPI \
ComponentFactory_CreateDecoderFromFilename(IWICComponentFactory *iface, LPCWSTR \
filename, + const GUID *vendor, DWORD desired_access, WICDecodeOptions options, \
IWICBitmapDecoder **decoder) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateDecoderFromFilename(&This->IWICImagingFactory2_iface, \
filename, vendor, + desired_access, options, decoder);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream(IWICComponentFactory \
*iface, IStream *stream, + const GUID *vendor, WICDecodeOptions options, \
IWICBitmapDecoder **decoder) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateDecoderFromStream(&This->IWICImagingFactory2_iface, \
stream, vendor, + options, decoder);
+}
+
+static HRESULT WINAPI \
ComponentFactory_CreateDecoderFromFileHandle(IWICComponentFactory *iface, ULONG_PTR \
hFile, + const GUID *vendor, WICDecodeOptions options, IWICBitmapDecoder \
**decoder) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateDecoderFromFileHandle(&This->IWICImagingFactory2_iface, \
hFile, vendor, + options, decoder);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateComponentInfo(IWICComponentFactory \
*iface, REFCLSID component, + IWICComponentInfo **info)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateComponentInfo(&This->IWICImagingFactory2_iface, \
component, info); +}
+
+static HRESULT WINAPI ComponentFactory_CreateDecoder(IWICComponentFactory *iface, \
REFGUID format, const GUID *vendor, + IWICBitmapDecoder **decoder)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateDecoder(&This->IWICImagingFactory2_iface, \
format, vendor, decoder); +}
+
+static HRESULT WINAPI ComponentFactory_CreateEncoder(IWICComponentFactory *iface, \
REFGUID format, const GUID *vendor, + IWICBitmapEncoder **encoder)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateEncoder(&This->IWICImagingFactory2_iface, \
format, vendor, encoder); +}
+
+static HRESULT WINAPI ComponentFactory_CreatePalette(IWICComponentFactory *iface, \
IWICPalette **palette) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreatePalette(&This->IWICImagingFactory2_iface, \
palette); +}
+
+static HRESULT WINAPI ComponentFactory_CreateFormatConverter(IWICComponentFactory \
*iface, IWICFormatConverter **converter) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateFormatConverter(&This->IWICImagingFactory2_iface, \
converter); +}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapScaler(IWICComponentFactory \
*iface, IWICBitmapScaler **scaler) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapScaler(&This->IWICImagingFactory2_iface, \
scaler); +}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapClipper(IWICComponentFactory \
*iface, IWICBitmapClipper **clipper) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapClipper(&This->IWICImagingFactory2_iface, \
clipper); +}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapFlipRotator(IWICComponentFactory \
*iface, IWICBitmapFlipRotator **fliprotator) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapFlipRotator(&This->IWICImagingFactory2_iface, \
fliprotator); +}
+
+static HRESULT WINAPI ComponentFactory_CreateStream(IWICComponentFactory *iface, \
IWICStream **stream) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateStream(&This->IWICImagingFactory2_iface, \
stream); +}
+
+static HRESULT WINAPI ComponentFactory_CreateColorContext(IWICComponentFactory \
*iface, IWICColorContext **context) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateColorContext(&This->IWICImagingFactory2_iface, \
context); +}
+
+static HRESULT WINAPI ComponentFactory_CreateColorTransformer(IWICComponentFactory \
*iface, IWICColorTransform **transformer) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateColorTransformer(&This->IWICImagingFactory2_iface, \
transformer); +}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmap(IWICComponentFactory *iface, \
UINT width, UINT height, REFWICPixelFormatGUID pixel_format, + \
WICBitmapCreateCacheOption option, IWICBitmap **bitmap) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmap(&This->IWICImagingFactory2_iface, width, \
height, pixel_format, option, bitmap); +}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource(IWICComponentFactory \
*iface, IWICBitmapSource *source, + WICBitmapCreateCacheOption option, IWICBitmap \
**bitmap) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapFromSource(&This->IWICImagingFactory2_iface, \
source, option, bitmap); +}
+
+static HRESULT WINAPI \
ComponentFactory_CreateBitmapFromSourceRect(IWICComponentFactory *iface, \
IWICBitmapSource *source, + UINT x, UINT y, UINT width, UINT height, IWICBitmap \
**bitmap) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapFromSourceRect(&This->IWICImagingFactory2_iface, \
source, x, y, width, height, bitmap); +}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory(IWICComponentFactory \
*iface, UINT width, UINT height, + REFWICPixelFormatGUID format, UINT stride, UINT \
size, BYTE *buffer, IWICBitmap **bitmap) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapFromMemory(&This->IWICImagingFactory2_iface, \
width, height, format, stride, + size, buffer, bitmap);
+}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP(IWICComponentFactory \
*iface, HBITMAP hbm, HPALETTE hpal, + WICBitmapAlphaChannelOption option, \
IWICBitmap **bitmap) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapFromHBITMAP(&This->IWICImagingFactory2_iface, \
hbm, hpal, option, bitmap); +}
+
+static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON(IWICComponentFactory \
*iface, HICON hicon, IWICBitmap **bitmap) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateBitmapFromHICON(&This->IWICImagingFactory2_iface, \
hicon, bitmap); +}
+
+static HRESULT WINAPI \
ComponentFactory_CreateComponentEnumerator(IWICComponentFactory *iface, DWORD \
component_types, + DWORD options, IEnumUnknown **enumerator)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateComponentEnumerator(&This->IWICImagingFactory2_iface, \
component_types, + options, enumerator);
+}
+
+static HRESULT WINAPI \
ComponentFactory_CreateFastMetadataEncoderFromDecoder(IWICComponentFactory *iface, \
IWICBitmapDecoder *decoder, + IWICFastMetadataEncoder **encoder)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateFastMetadataEncoderFromDecoder(&This->IWICImagingFactory2_iface, \
decoder, encoder); +}
+
+static HRESULT WINAPI \
ComponentFactory_CreateFastMetadataEncoderFromFrameDecode(IWICComponentFactory \
*iface, + IWICBitmapFrameDecode *frame_decode, IWICFastMetadataEncoder **encoder)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateFastMetadataEncoderFromFrameDecode(&This->IWICImagingFactory2_iface, \
frame_decode, encoder); +}
+
+static HRESULT WINAPI ComponentFactory_CreateQueryWriter(IWICComponentFactory \
*iface, REFGUID format, const GUID *vendor, + IWICMetadataQueryWriter **writer)
+{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateQueryWriter(&This->IWICImagingFactory2_iface, \
format, vendor, writer); +}
+
+static HRESULT WINAPI \
ComponentFactory_CreateQueryWriterFromReader(IWICComponentFactory *iface, \
IWICMetadataQueryReader *reader, + const GUID *vendor, IWICMetadataQueryWriter \
**writer) +{
+ ImagingFactory *This = impl_from_IWICComponentFactory(iface);
+ return IWICImagingFactory2_CreateQueryWriterFromReader(&This->IWICImagingFactory2_iface, \
reader, vendor, writer); +}
+
static HRESULT WINAPI ComponentFactory_CreateMetadataReader(IWICComponentFactory \
*iface,
REFGUID format, const GUID *vendor, DWORD options, IStream *stream, \
IWICMetadataReader **reader) {
@@ -1181,23 +1418,24 @@ static const IWICComponentFactoryVtbl ComponentFactory_Vtbl = \
{ ComponentFactory_CreateEncoderPropertyBag
};
-HRESULT ComponentFactory_CreateInstance(REFIID iid, void** ppv)
+HRESULT ImagingFactory_CreateInstance(REFIID iid, void** ppv)
{
- ComponentFactory *This;
+ ImagingFactory *This;
HRESULT ret;
TRACE("(%s,%p)\n", debugstr_guid(iid), ppv);
*ppv = NULL;
- This = HeapAlloc(GetProcessHeap(), 0, sizeof(ComponentFactory));
+ This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This) return E_OUTOFMEMORY;
+ This->IWICImagingFactory2_iface.lpVtbl = &ImagingFactory_Vtbl;
This->IWICComponentFactory_iface.lpVtbl = &ComponentFactory_Vtbl;
This->ref = 1;
- ret = IWICComponentFactory_QueryInterface(&This->IWICComponentFactory_iface, \
iid, ppv);
- IWICComponentFactory_Release(&This->IWICComponentFactory_iface);
+ ret = IWICImagingFactory2_QueryInterface(&This->IWICImagingFactory2_iface, iid, \
ppv); + IWICImagingFactory2_Release(&This->IWICImagingFactory2_iface);
return ret;
}
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index 6b13112130..42a1f2f515 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -1240,7 +1240,7 @@ static HRESULT WINAPI \
PngDecoder_Block_GetReaderByIndex(IWICMetadataBlockReader
This->metadata_blocks[nIndex].ofs, \
This->metadata_blocks[nIndex].len);
if (SUCCEEDED(hr))
- hr = ComponentFactory_CreateInstance(&IID_IWICComponentFactory, \
(void**)&factory); + hr = \
ImagingFactory_CreateInstance(&IID_IWICComponentFactory, (void**)&factory);
if (SUCCEEDED(hr))
{
diff --git a/dlls/windowscodecs/proxy.c b/dlls/windowscodecs/proxy.c
index a28b38681e..d53059e65b 100644
--- a/dlls/windowscodecs/proxy.c
+++ b/dlls/windowscodecs/proxy.c
@@ -637,7 +637,7 @@ HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT SDKVersion, \
IWICImagingFactory {
TRACE("%x, %p\n", SDKVersion, ppIImagingFactory);
- return ComponentFactory_CreateInstance(&IID_IWICImagingFactory, \
(void**)ppIImagingFactory); + return \
ImagingFactory_CreateInstance(&IID_IWICImagingFactory, (void**)ppIImagingFactory); }
HRESULT WINAPI WICSetEncoderFormat_Proxy(IWICBitmapSource *pSourceIn,
diff --git a/dlls/windowscodecs/tests/info.c b/dlls/windowscodecs/tests/info.c
index b647601495..ee95784166 100644
--- a/dlls/windowscodecs/tests/info.c
+++ b/dlls/windowscodecs/tests/info.c
@@ -637,6 +637,38 @@ todo_wine
IWICImagingFactory_Release(factory);
}
+static void test_imagingfactory_interfaces(void)
+{
+ IWICComponentFactory *component_factory;
+ IWICImagingFactory2 *factory2;
+ IWICImagingFactory *factory;
+ HRESULT hr;
+
+ hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IWICImagingFactory2, (void **)&factory2);
+ if (FAILED(hr))
+ {
+ win_skip("IWICImagingFactory2 is not supported.\n");
+ return;
+ }
+
+ hr = IWICImagingFactory2_QueryInterface(factory2, &IID_IWICComponentFactory, \
(void **)&component_factory); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ hr = IWICComponentFactory_QueryInterface(component_factory, \
&IID_IWICImagingFactory, (void **)&factory); + ok(hr == S_OK, "Unexpected hr \
%#x.\n", hr); + ok(factory == (IWICImagingFactory *)component_factory, "Unexpected \
factory pointer.\n"); + IWICImagingFactory_Release(factory);
+
+ hr = IWICImagingFactory2_QueryInterface(factory2, &IID_IWICImagingFactory, (void \
**)&factory); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ ok(factory == (IWICImagingFactory *)component_factory, "Unexpected factory \
pointer.\n"); +
+ IWICComponentFactory_Release(component_factory);
+ IWICImagingFactory2_Release(factory2);
+ IWICImagingFactory_Release(factory);
+}
+
START_TEST(info)
{
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
@@ -644,6 +676,7 @@ START_TEST(info)
test_decoder_info();
test_reader_info();
test_pixelformat_info();
+ test_imagingfactory_interfaces();
CoUninitialize();
}
diff --git a/dlls/windowscodecs/wincodecs_private.h \
b/dlls/windowscodecs/wincodecs_private.h index b29fc1fa4d..f7950c4105 100644
--- a/dlls/windowscodecs/wincodecs_private.h
+++ b/dlls/windowscodecs/wincodecs_private.h
@@ -75,7 +75,7 @@ HRESULT create_instance(CLSID *clsid, const IID *iid, void **ppv) \
DECLSPEC_HIDDE
typedef HRESULT(*class_constructor)(REFIID,void**);
extern HRESULT FormatConverter_CreateInstance(REFIID riid, void** ppv) \
DECLSPEC_HIDDEN;
-extern HRESULT ComponentFactory_CreateInstance(REFIID riid, void** ppv) \
DECLSPEC_HIDDEN; +extern HRESULT ImagingFactory_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;
--
2.19.0
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic