[PATCH 4/4] wined3d: Pass an IWineD3DResourceImpl pointer to resource_get_private_data().

Henri Verbeet hverbeet at codeweavers.com
Thu Jan 6 02:39:02 CST 2011


---
 dlls/wined3d/buffer.c          |    2 +-
 dlls/wined3d/cubetexture.c     |    6 ++++--
 dlls/wined3d/resource.c        |   39 +++++++++++++++++++++------------------
 dlls/wined3d/surface_base.c    |    6 ++++--
 dlls/wined3d/texture.c         |    6 ++++--
 dlls/wined3d/volume.c          |    6 ++++--
 dlls/wined3d/volumetexture.c   |    6 ++++--
 dlls/wined3d/wined3d_private.h |    2 +-
 8 files changed, 43 insertions(+), 30 deletions(-)

diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index e3f71a0..43fe20e 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -770,7 +770,7 @@ static HRESULT STDMETHODCALLTYPE buffer_SetPrivateData(IWineD3DBuffer *iface,
 static HRESULT STDMETHODCALLTYPE buffer_GetPrivateData(IWineD3DBuffer *iface,
         REFGUID guid, void *data, DWORD *data_size)
 {
-    return resource_get_private_data((IWineD3DResource *)iface, guid, data, data_size);
+    return resource_get_private_data((IWineD3DResourceImpl *)iface, guid, data, data_size);
 }
 
 static HRESULT STDMETHODCALLTYPE buffer_FreePrivateData(IWineD3DBuffer *iface, REFGUID guid)
diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index 2449b79..89afcbf 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -218,8 +218,10 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_SetPrivateData(IWineD3DCubeTexture
     return resource_set_private_data((IWineD3DResource *)iface, riid, data, data_size, flags);
 }
 
-static HRESULT WINAPI IWineD3DCubeTextureImpl_GetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
-    return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
+static HRESULT WINAPI IWineD3DCubeTextureImpl_GetPrivateData(IWineD3DCubeTexture *iface,
+        REFGUID guid, void *data, DWORD *data_size)
+{
+    return resource_get_private_data((IWineD3DResourceImpl *)iface, guid, data, data_size);
 }
 
 static HRESULT WINAPI IWineD3DCubeTextureImpl_FreePrivateData(IWineD3DCubeTexture *iface, REFGUID refguid)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 76267d5..173fa58 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -192,33 +192,36 @@ HRESULT resource_set_private_data(IWineD3DResource *iface, REFGUID refguid,
     return WINED3D_OK;
 }
 
-HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID refguid, void *pData, DWORD *pSizeOfData)
+HRESULT resource_get_private_data(struct IWineD3DResourceImpl *resource, REFGUID guid, void *data, DWORD *data_size)
 {
-    IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
-    struct private_data *data;
+    const struct private_data *d;
 
-    TRACE("(%p) : %p %p %p\n", This, refguid, pData, pSizeOfData);
-    data = resource_find_private_data(This, refguid);
-    if (!data) return WINED3DERR_NOTFOUND;
+    TRACE("resource %p, guid %s, data %p, data_size %p.\n",
+            resource, debugstr_guid(guid), data, data_size);
+
+    d = resource_find_private_data(resource, guid);
+    if (!d) return WINED3DERR_NOTFOUND;
 
-    if (*pSizeOfData < data->size) {
-        *pSizeOfData = data->size;
+    if (*data_size < d->size)
+    {
+        *data_size = d->size;
         return WINED3DERR_MOREDATA;
     }
 
-    if (data->flags & WINED3DSPD_IUNKNOWN) {
-        *(LPUNKNOWN *)pData = data->ptr.object;
-        if (((IWineD3DImpl *)This->resource.device->wined3d)->dxVersion != 7)
+    if (d->flags & WINED3DSPD_IUNKNOWN)
+    {
+        *(IUnknown **)data = d->ptr.object;
+        if (((IWineD3DImpl *)resource->resource.device->wined3d)->dxVersion != 7)
         {
-            /* D3D8 and D3D9 addref the private data, DDraw does not. This can't be handled in
-             * ddraw because it doesn't know if the pointer returned is an IUnknown * or just a
-             * Blob
-             */
-            IUnknown_AddRef(data->ptr.object);
+            /* D3D8 and D3D9 addref the private data, DDraw does not. This
+             * can't be handled in ddraw because it doesn't know if the
+             * pointer returned is an IUnknown * or just a blob. */
+            IUnknown_AddRef(d->ptr.object);
         }
     }
-    else {
-        memcpy(pData, data->ptr.data, data->size);
+    else
+    {
+        memcpy(data, d->ptr.data, d->size);
     }
 
     return WINED3D_OK;
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index 14268b8..c499d71 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -117,8 +117,10 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPrivateData(IWineD3DSurface *iface,
     return resource_set_private_data((IWineD3DResource *)iface, riid, data, data_size, flags);
 }
 
-HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPrivateData(IWineD3DSurface *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
-    return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
+HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPrivateData(IWineD3DSurface *iface,
+        REFGUID guid, void *data, DWORD *data_size)
+{
+    return resource_get_private_data((IWineD3DResourceImpl *)iface, guid, data, data_size);
 }
 
 HRESULT WINAPI IWineD3DBaseSurfaceImpl_FreePrivateData(IWineD3DSurface *iface, REFGUID refguid)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index bb00fc4..7759435 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -243,8 +243,10 @@ static HRESULT WINAPI IWineD3DTextureImpl_SetPrivateData(IWineD3DTexture *iface,
     return resource_set_private_data((IWineD3DResource *)iface, riid, data, data_size, flags);
 }
 
-static HRESULT WINAPI IWineD3DTextureImpl_GetPrivateData(IWineD3DTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
-    return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
+static HRESULT WINAPI IWineD3DTextureImpl_GetPrivateData(IWineD3DTexture *iface,
+        REFGUID guid, void *data, DWORD *data_size)
+{
+    return resource_get_private_data((IWineD3DResourceImpl *)iface, guid, data, data_size);
 }
 
 static HRESULT WINAPI IWineD3DTextureImpl_FreePrivateData(IWineD3DTexture *iface, REFGUID refguid)
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 4c55170..6334966 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -156,8 +156,10 @@ static HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface,
     return resource_set_private_data((IWineD3DResource *)iface, riid, data, data_size, flags);
 }
 
-static HRESULT WINAPI IWineD3DVolumeImpl_GetPrivateData(IWineD3DVolume *iface, REFGUID  refguid, void* pData, DWORD* pSizeOfData) {
-    return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
+static HRESULT WINAPI IWineD3DVolumeImpl_GetPrivateData(IWineD3DVolume *iface,
+        REFGUID guid, void *data, DWORD *data_size)
+{
+    return resource_get_private_data((IWineD3DResourceImpl *)iface, guid, data, data_size);
 }
 
 static HRESULT WINAPI IWineD3DVolumeImpl_FreePrivateData(IWineD3DVolume *iface, REFGUID refguid)
diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c
index e3e16d3..ed837a7 100644
--- a/dlls/wined3d/volumetexture.c
+++ b/dlls/wined3d/volumetexture.c
@@ -163,8 +163,10 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_SetPrivateData(IWineD3DVolumeTex
     return resource_set_private_data((IWineD3DResource *)iface, riid, data, data_size, flags);
 }
 
-static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetPrivateData(IWineD3DVolumeTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
-    return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
+static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetPrivateData(IWineD3DVolumeTexture *iface,
+        REFGUID guid, void *data, DWORD *data_size)
+{
+    return resource_get_private_data((IWineD3DResourceImpl *)iface, guid, data, data_size);
 }
 
 static HRESULT WINAPI IWineD3DVolumeTextureImpl_FreePrivateData(IWineD3DVolumeTexture *iface, REFGUID refguid)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 5a0d068..d6de00e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1831,7 +1831,7 @@ typedef struct IWineD3DResourceImpl
 void resource_cleanup(struct IWineD3DResourceImpl *resource) DECLSPEC_HIDDEN;
 HRESULT resource_free_private_data(struct IWineD3DResourceImpl *resource, REFGUID guid) DECLSPEC_HIDDEN;
 DWORD resource_get_priority(IWineD3DResource *iface) DECLSPEC_HIDDEN;
-HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid,
+HRESULT resource_get_private_data(struct IWineD3DResourceImpl *resource, REFGUID guid,
         void *data, DWORD *data_size) DECLSPEC_HIDDEN;
 HRESULT resource_init(struct IWineD3DResourceImpl *resource, WINED3DRESOURCETYPE resource_type,
         IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format,
-- 
1.7.2.2




More information about the wine-patches mailing list