Ziqing Hui : windowscodecs: Add stub implementation for IWICDdsFrameDecode.

Alexandre Julliard julliard at winehq.org
Tue Apr 28 16:32:21 CDT 2020


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

Author: Ziqing Hui <zhui at codeweavers.com>
Date:   Tue Apr 28 10:56:54 2020 +0800

windowscodecs: Add stub implementation for IWICDdsFrameDecode.

Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/windowscodecs/ddsformat.c | 62 ++++++++++++++++++++++++++++++++++++++++++
 include/wincodec.idl           | 28 +++++++++++++++++++
 2 files changed, 90 insertions(+)

diff --git a/dlls/windowscodecs/ddsformat.c b/dlls/windowscodecs/ddsformat.c
index cf8fadbce5..f096f94b6a 100644
--- a/dlls/windowscodecs/ddsformat.c
+++ b/dlls/windowscodecs/ddsformat.c
@@ -97,6 +97,7 @@ typedef struct DdsDecoder {
 
 typedef struct DdsFrameDecode {
     IWICBitmapFrameDecode IWICBitmapFrameDecode_iface;
+    IWICDdsFrameDecode IWICDdsFrameDecode_iface;
     LONG ref;
 } DdsFrameDecode;
 
@@ -121,6 +122,11 @@ static inline DdsFrameDecode *impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDec
     return CONTAINING_RECORD(iface, DdsFrameDecode, IWICBitmapFrameDecode_iface);
 }
 
+static inline DdsFrameDecode *impl_from_IWICDdsFrameDecode(IWICDdsFrameDecode *iface)
+{
+    return CONTAINING_RECORD(iface, DdsFrameDecode, IWICDdsFrameDecode_iface);
+}
+
 static HRESULT WINAPI DdsFrameDecode_QueryInterface(IWICBitmapFrameDecode *iface, REFIID iid,
                                                     void **ppv)
 {
@@ -133,6 +139,8 @@ static HRESULT WINAPI DdsFrameDecode_QueryInterface(IWICBitmapFrameDecode *iface
         IsEqualIID(&IID_IWICBitmapSource, iid) ||
         IsEqualIID(&IID_IWICBitmapFrameDecode, iid)) {
         *ppv = &This->IWICBitmapFrameDecode_iface;
+    } else if (IsEqualGUID(&IID_IWICDdsFrameDecode, iid)) {
+        *ppv = &This->IWICDdsFrameDecode_iface;
     } else {
         *ppv = NULL;
         return E_NOINTERFACE;
@@ -242,6 +250,59 @@ static const IWICBitmapFrameDecodeVtbl DdsFrameDecode_Vtbl = {
     DdsFrameDecode_GetThumbnail
 };
 
+static HRESULT WINAPI DdsFrameDecode_Dds_QueryInterface(IWICDdsFrameDecode *iface,
+                                                        REFIID iid, void **ppv)
+{
+    DdsFrameDecode *This = impl_from_IWICDdsFrameDecode(iface);
+    return DdsFrameDecode_QueryInterface(&This->IWICBitmapFrameDecode_iface, iid, ppv);
+}
+
+static ULONG WINAPI DdsFrameDecode_Dds_AddRef(IWICDdsFrameDecode *iface)
+{
+    DdsFrameDecode *This = impl_from_IWICDdsFrameDecode(iface);
+    return DdsFrameDecode_AddRef(&This->IWICBitmapFrameDecode_iface);
+}
+
+static ULONG WINAPI DdsFrameDecode_Dds_Release(IWICDdsFrameDecode *iface)
+{
+    DdsFrameDecode *This = impl_from_IWICDdsFrameDecode(iface);
+    return DdsFrameDecode_Release(&This->IWICBitmapFrameDecode_iface);
+}
+
+static HRESULT WINAPI DdsFrameDecode_Dds_GetSizeInBlocks(IWICDdsFrameDecode *iface,
+                                                         UINT *widthInBlocks, UINT *heightInBlocks)
+{
+    FIXME("(%p,%p,%p): stub.\n", iface, widthInBlocks, heightInBlocks);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DdsFrameDecode_Dds_GetFormatInfo(IWICDdsFrameDecode *iface,
+                                                       WICDdsFormatInfo *formatInfo)
+{
+    FIXME("(%p,%p): stub.\n", iface, formatInfo);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DdsFrameDecode_Dds_CopyBlocks(IWICDdsFrameDecode *iface,
+                                                    const WICRect *boundsInBlocks, UINT stride, UINT bufferSize,
+                                                    BYTE *buffer)
+{
+    FIXME("(%p,%p,%u,%u,%p): stub.\n", iface, boundsInBlocks, stride, bufferSize, buffer);
+
+    return E_NOTIMPL;
+}
+
+static const IWICDdsFrameDecodeVtbl DdsFrameDecode_Dds_Vtbl = {
+    DdsFrameDecode_Dds_QueryInterface,
+    DdsFrameDecode_Dds_AddRef,
+    DdsFrameDecode_Dds_Release,
+    DdsFrameDecode_Dds_GetSizeInBlocks,
+    DdsFrameDecode_Dds_GetFormatInfo,
+    DdsFrameDecode_Dds_CopyBlocks
+};
+
 static HRESULT DdsFrameDecode_CreateInstance(DdsFrameDecode **frame_decode)
 {
     DdsFrameDecode *result;
@@ -250,6 +311,7 @@ static HRESULT DdsFrameDecode_CreateInstance(DdsFrameDecode **frame_decode)
     if (!result) return E_OUTOFMEMORY;
 
     result->IWICBitmapFrameDecode_iface.lpVtbl = &DdsFrameDecode_Vtbl;
+    result->IWICDdsFrameDecode_iface.lpVtbl = &DdsFrameDecode_Dds_Vtbl;
     result->ref = 1;
 
     *frame_decode = result;
diff --git a/include/wincodec.idl b/include/wincodec.idl
index e5fdc15c64..e64d9ed3f1 100644
--- a/include/wincodec.idl
+++ b/include/wincodec.idl
@@ -371,6 +371,13 @@ typedef struct WICDdsParameters {
     WICDdsAlphaMode AlphaMode;
 } WICDdsParameters;
 
+typedef struct WICDdsFormatInfo {
+    DXGI_FORMAT DxgiFormat;
+    UINT BytesPerBlock;
+    UINT BlockWidth;
+    UINT BlockHeight;
+} WICDdsFormatInfo;
+
 typedef UINT32 WICColor;
 
 interface ID2D1Device;
@@ -1189,6 +1196,27 @@ interface IWICDdsDecoder : IUnknown
         [out, retval] IWICBitmapFrameDecode **bitmapFrame);
 };
 
+[
+    object,
+    uuid(3d4c0c61-18a4-41e4-bd80-481a4fc9f464)
+]
+interface IWICDdsFrameDecode : IUnknown
+{
+    HRESULT GetSizeInBlocks(
+        [out] UINT *widthInBlocks,
+        [out] UINT *heightInBlocks);
+
+    HRESULT GetFormatInfo(
+        [out] WICDdsFormatInfo *formatInfo);
+
+    HRESULT CopyBlocks(
+        [in, unique] const WICRect *boundsInBlocks,
+        [in] UINT stride,
+        [in] UINT bufferSize,
+        [out, size_is(bufferSize)] BYTE *buffer);
+};
+
+
 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);")




More information about the wine-cvs mailing list