Michael Stefaniuc : d3d9: Use unsafe_impl_from_IDirect3DIndexBuffer9 for an app provided iface.
Alexandre Julliard
julliard at winehq.org
Tue Jul 5 12:59:05 CDT 2011
Module: wine
Branch: master
Commit: 875d6900c6faf88d6ba53d1fa8598936ed33bc78
URL: http://source.winehq.org/git/wine.git/?a=commit;h=875d6900c6faf88d6ba53d1fa8598936ed33bc78
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Tue Jul 5 12:01:01 2011 +0200
d3d9: Use unsafe_impl_from_IDirect3DIndexBuffer9 for an app provided iface.
---
dlls/d3d9/buffer.c | 10 ++++++++++
dlls/d3d9/d3d9_private.h | 1 +
dlls/d3d9/device.c | 2 +-
3 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/dlls/d3d9/buffer.c b/dlls/d3d9/buffer.c
index 8a86e6e..7d35927 100644
--- a/dlls/d3d9/buffer.c
+++ b/dlls/d3d9/buffer.c
@@ -19,6 +19,7 @@
*/
#include "config.h"
+#include <assert.h>
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
@@ -573,3 +574,12 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl
return D3D_OK;
}
+
+IDirect3DIndexBuffer9Impl *unsafe_impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface)
+{
+ if (!iface)
+ return NULL;
+ assert(iface->lpVtbl == &d3d9_indexbuffer_vtbl);
+
+ return impl_from_IDirect3DIndexBuffer9(iface);
+}
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index 87ff3fd..9171181 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -283,6 +283,7 @@ typedef struct IDirect3DIndexBuffer9Impl
HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl *device,
UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
+IDirect3DIndexBuffer9Impl *unsafe_impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBuffer9 *iface) DECLSPEC_HIDDEN;
/* --------------------- */
/* IDirect3DBaseTexture9 */
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 5aa324e..0c726d9 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2528,8 +2528,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(IDirect3DDevice9Ex *iface,
IDirect3DIndexBuffer9 *pIndexData)
{
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
+ IDirect3DIndexBuffer9Impl *ib = unsafe_impl_from_IDirect3DIndexBuffer9(pIndexData);
HRESULT hr;
- IDirect3DIndexBuffer9Impl *ib = (IDirect3DIndexBuffer9Impl *) pIndexData;
TRACE("iface %p, buffer %p.\n", iface, pIndexData);
More information about the wine-cvs
mailing list