windowscodecs: Add IWICWineDecoder stub for DDS decoder.

Initializing cube map and uncompressed DDS is not supported in WIC.
But we would like to use them in other part of wine. So we introduce
a Wine-specific interface to initialize them.

Signed-off-by: Ziqing Hui <zhui@codeweavers.com>
Signed-off-by: Esme Povirk <esme@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ziqing Hui 2020-07-10 17:08:49 +08:00 committed by Alexandre Julliard
parent 43788707ce
commit d7ef1cd82c
2 changed files with 50 additions and 0 deletions

View File

@ -125,6 +125,7 @@ typedef struct dds_frame_info {
typedef struct DdsDecoder {
IWICBitmapDecoder IWICBitmapDecoder_iface;
IWICDdsDecoder IWICDdsDecoder_iface;
IWICWineDecoder IWICWineDecoder_iface;
LONG ref;
BOOL initialized;
IStream *stream;
@ -281,6 +282,11 @@ static inline DdsDecoder *impl_from_IWICDdsDecoder(IWICDdsDecoder *iface)
return CONTAINING_RECORD(iface, DdsDecoder, IWICDdsDecoder_iface);
}
static inline DdsDecoder *impl_from_IWICWineDecoder(IWICWineDecoder *iface)
{
return CONTAINING_RECORD(iface, DdsDecoder, IWICWineDecoder_iface);
}
static inline DdsFrameDecode *impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDecode *iface)
{
return CONTAINING_RECORD(iface, DdsFrameDecode, IWICBitmapFrameDecode_iface);
@ -566,6 +572,8 @@ static HRESULT WINAPI DdsDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID
*ppv = &This->IWICBitmapDecoder_iface;
} else if (IsEqualIID(&IID_IWICDdsDecoder, iid)) {
*ppv = &This->IWICDdsDecoder_iface;
} else if (IsEqualIID(&IID_IWICWineDecoder, iid)) {
*ppv = &This->IWICWineDecoder_iface;
} else {
*ppv = NULL;
return E_NOINTERFACE;
@ -959,6 +967,37 @@ static const IWICDdsDecoderVtbl DdsDecoder_Dds_Vtbl = {
DdsDecoder_Dds_GetFrame
};
static HRESULT WINAPI DdsDecoder_Wine_QueryInterface(IWICWineDecoder *iface, REFIID iid, void **ppv)
{
DdsDecoder *This = impl_from_IWICWineDecoder(iface);
return DdsDecoder_QueryInterface(&This->IWICBitmapDecoder_iface, iid, ppv);
}
static ULONG WINAPI DdsDecoder_Wine_AddRef(IWICWineDecoder *iface)
{
DdsDecoder *This = impl_from_IWICWineDecoder(iface);
return DdsDecoder_AddRef(&This->IWICBitmapDecoder_iface);
}
static ULONG WINAPI DdsDecoder_Wine_Release(IWICWineDecoder *iface)
{
DdsDecoder *This = impl_from_IWICWineDecoder(iface);
return DdsDecoder_Release(&This->IWICBitmapDecoder_iface);
}
static HRESULT WINAPI DdsDecoder_Wine_Initialize(IWICWineDecoder *iface, IStream *stream, WICDecodeOptions options)
{
FIXME("(This %p, stream %p, options %#x)\n", iface, stream, options);
return E_NOTIMPL;
}
static const IWICWineDecoderVtbl DdsDecoder_Wine_Vtbl = {
DdsDecoder_Wine_QueryInterface,
DdsDecoder_Wine_AddRef,
DdsDecoder_Wine_Release,
DdsDecoder_Wine_Initialize
};
HRESULT DdsDecoder_CreateInstance(REFIID iid, void** ppv)
{
DdsDecoder *This;
@ -973,6 +1012,7 @@ HRESULT DdsDecoder_CreateInstance(REFIID iid, void** ppv)
This->IWICBitmapDecoder_iface.lpVtbl = &DdsDecoder_Vtbl;
This->IWICDdsDecoder_iface.lpVtbl = &DdsDecoder_Dds_Vtbl;
This->IWICWineDecoder_iface.lpVtbl = &DdsDecoder_Wine_Vtbl;
This->ref = 1;
This->initialized = FALSE;
This->stream = NULL;

View File

@ -1216,6 +1216,16 @@ interface IWICDdsFrameDecode : IUnknown
[out, size_is(bufferSize)] BYTE *buffer);
};
[
object,
uuid(b9bd430d-28a8-41d3-a1f5-f36ee02840bf)
]
interface IWICWineDecoder : IUnknown
{
HRESULT Initialize(
[in] IStream *stream,
[in] WICDecodeOptions options);
};
cpp_quote("HRESULT WINAPI WICConvertBitmapSource(REFWICPixelFormatGUID dstFormat, IWICBitmapSource *pISrc, IWICBitmapSource **ppIDst);")
cpp_quote("HRESULT WINAPI WICCreateBitmapFromSection(UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, IWICBitmap **bitmap);")