Ziqing Hui : windowscodecs: Add IWICWineDecoder stub for DDS decoder.

Alexandre Julliard julliard at winehq.org
Mon Jul 13 16:08:50 CDT 2020


Module: wine
Branch: master
Commit: d7ef1cd82c8892c530d375e59dbf6e1e4cd3e3c2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d7ef1cd82c8892c530d375e59dbf6e1e4cd3e3c2

Author: Ziqing Hui <zhui at codeweavers.com>
Date:   Fri Jul 10 17:08:49 2020 +0800

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 at codeweavers.com>
Signed-off-by: Esme Povirk <esme at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/windowscodecs/ddsformat.c | 40 ++++++++++++++++++++++++++++++++++++++++
 include/wincodec.idl           | 10 ++++++++++
 2 files changed, 50 insertions(+)

diff --git a/dlls/windowscodecs/ddsformat.c b/dlls/windowscodecs/ddsformat.c
index 7a28b82e3d..295b935a26 100644
--- a/dlls/windowscodecs/ddsformat.c
+++ b/dlls/windowscodecs/ddsformat.c
@@ -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;
diff --git a/include/wincodec.idl b/include/wincodec.idl
index e64d9ed3f1..88e183d579 100644
--- a/include/wincodec.idl
+++ b/include/wincodec.idl
@@ -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);")




More information about the wine-cvs mailing list