windowscodecs: Add stub implementation for IWICDdsDecoder.

Signed-off-by: Ziqing Hui <zhui@codeweavers.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ziqing Hui 2020-04-28 10:55:04 +08:00 committed by Alexandre Julliard
parent db0f5027d7
commit d42946ea43
2 changed files with 100 additions and 5 deletions

View File

@ -86,6 +86,7 @@ typedef struct {
typedef struct DdsDecoder {
IWICBitmapDecoder IWICBitmapDecoder_iface;
IWICDdsDecoder IWICDdsDecoder_iface;
LONG ref;
BOOL initialized;
IStream *stream;
@ -110,6 +111,11 @@ static inline DdsDecoder *impl_from_IWICBitmapDecoder(IWICBitmapDecoder *iface)
return CONTAINING_RECORD(iface, DdsDecoder, IWICBitmapDecoder_iface);
}
static inline DdsDecoder *impl_from_IWICDdsDecoder(IWICDdsDecoder *iface)
{
return CONTAINING_RECORD(iface, DdsDecoder, IWICDdsDecoder_iface);
}
static inline DdsFrameDecode *impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDecode *iface)
{
return CONTAINING_RECORD(iface, DdsFrameDecode, IWICBitmapFrameDecode_iface);
@ -259,12 +265,11 @@ static HRESULT WINAPI DdsDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID
if (!ppv) return E_INVALIDARG;
if (IsEqualIID(&IID_IUnknown, iid) ||
IsEqualIID(&IID_IWICBitmapDecoder, iid))
{
IsEqualIID(&IID_IWICBitmapDecoder, iid)) {
*ppv = &This->IWICBitmapDecoder_iface;
}
else
{
} else if (IsEqualIID(&IID_IWICDdsDecoder, iid)) {
*ppv = &This->IWICDdsDecoder_iface;
} else {
*ppv = NULL;
return E_NOINTERFACE;
}
@ -498,6 +503,50 @@ static const IWICBitmapDecoderVtbl DdsDecoder_Vtbl = {
DdsDecoder_GetFrame
};
static HRESULT WINAPI DdsDecoder_Dds_QueryInterface(IWICDdsDecoder *iface,
REFIID iid, void **ppv)
{
DdsDecoder *This = impl_from_IWICDdsDecoder(iface);
return DdsDecoder_QueryInterface(&This->IWICBitmapDecoder_iface, iid, ppv);
}
static ULONG WINAPI DdsDecoder_Dds_AddRef(IWICDdsDecoder *iface)
{
DdsDecoder *This = impl_from_IWICDdsDecoder(iface);
return DdsDecoder_AddRef(&This->IWICBitmapDecoder_iface);
}
static ULONG WINAPI DdsDecoder_Dds_Release(IWICDdsDecoder *iface)
{
DdsDecoder *This = impl_from_IWICDdsDecoder(iface);
return DdsDecoder_Release(&This->IWICBitmapDecoder_iface);
}
static HRESULT WINAPI DdsDecoder_Dds_GetParameters(IWICDdsDecoder *iface,
WICDdsParameters *parameters)
{
TRACE("(%p,%p): Stub.\n", iface, parameters);
return E_NOTIMPL;
}
static HRESULT WINAPI DdsDecoder_Dds_GetFrame(IWICDdsDecoder *iface,
UINT arrayIndex, UINT mipLevel, UINT sliceIndex,
IWICBitmapFrameDecode **bitmapFrame)
{
TRACE("(%p,%u,%u,%u,%p): Stub.\n", iface, arrayIndex, mipLevel, sliceIndex, bitmapFrame);
return E_NOTIMPL;
}
static const IWICDdsDecoderVtbl DdsDecoder_Dds_Vtbl = {
DdsDecoder_Dds_QueryInterface,
DdsDecoder_Dds_AddRef,
DdsDecoder_Dds_Release,
DdsDecoder_Dds_GetParameters,
DdsDecoder_Dds_GetFrame
};
HRESULT DdsDecoder_CreateInstance(REFIID iid, void** ppv)
{
DdsDecoder *This;
@ -511,6 +560,7 @@ HRESULT DdsDecoder_CreateInstance(REFIID iid, void** ppv)
if (!This) return E_OUTOFMEMORY;
This->IWICBitmapDecoder_iface.lpVtbl = &DdsDecoder_Vtbl;
This->IWICDdsDecoder_iface.lpVtbl = &DdsDecoder_Dds_Vtbl;
This->ref = 1;
This->initialized = FALSE;
This->stream = NULL;

View File

@ -19,6 +19,7 @@
import "wtypes.idl";
import "propidl.idl";
import "ocidl.idl";
import "dxgiformat.idl";
cpp_quote ("#include \"dcommon.h\"")
@ -195,6 +196,23 @@ typedef enum WICSectionAccessLevel {
WICSectionAccessLevel_FORCE_DWORD = CODEC_FORCE_DWORD
} WICSectionAccessLevel;
typedef enum WICDdsDimension {
WICDdsTexture1D = 0x00000000,
WICDdsTexture2D = 0x00000001,
WICDdsTexture3D = 0x00000002,
WICDdsTextureCube = 0x00000003,
WICDDSTEXTURE_FORCE_DWORD = CODEC_FORCE_DWORD
} WICDdsDimension;
typedef enum WICDdsAlphaMode {
WICDdsAlphaModeUnknown = 0x00000000,
WICDdsAlphaModeStraight = 0x00000001,
WICDdsAlphaModePremultiplied = 0x00000002,
WICDdsAlphaModeOpaque = 0x00000003,
WICDdsAlphaModeCustom = 0x00000004,
WICDDSALPHAMODE_FORCE_DWORD = CODEC_FORCE_DWORD
} WICDdsAlphaMode;
typedef GUID WICPixelFormatGUID;
typedef REFGUID REFWICPixelFormatGUID;
@ -342,6 +360,17 @@ typedef struct WICImageParameters
UINT32 PixelHeight;
} WICImageParameters;
typedef struct WICDdsParameters {
UINT Width;
UINT Height;
UINT Depth;
UINT MipLevels;
UINT ArraySize;
DXGI_FORMAT DxgiFormat;
WICDdsDimension Dimension;
WICDdsAlphaMode AlphaMode;
} WICDdsParameters;
typedef UINT32 WICColor;
interface ID2D1Device;
@ -1144,6 +1173,22 @@ interface IWICEnumMetadataItem : IUnknown
[out] IWICEnumMetadataItem **ppIEnumMetadataItem);
}
[
object,
uuid(409cd537-8532-40cb-9774-e2feb2df4e9c)
]
interface IWICDdsDecoder : IUnknown
{
HRESULT GetParameters(
[out] WICDdsParameters *parameters);
HRESULT GetFrame(
[in] UINT arrayIndex,
[in] UINT mipLevel,
[in] UINT sliceIndex,
[out, retval] IWICBitmapFrameDecode **bitmapFrame);
};
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);")
cpp_quote("HRESULT WINAPI WICCreateBitmapFromSectionEx(UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, WICSectionAccessLevel access, IWICBitmap **bitmap);")