d3d8: Use unsafe_impl_from_IDirect3DVertexBuffer8 for app provided ifaces.

This commit is contained in:
Michael Stefaniuc 2011-07-08 12:22:14 +02:00 committed by Alexandre Julliard
parent 23dd500a64
commit aa8e4dd81b
3 changed files with 13 additions and 3 deletions

View File

@ -298,6 +298,15 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im
return D3D_OK;
}
IDirect3DVertexBuffer8Impl *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &Direct3DVertexBuffer8_Vtbl);
return impl_from_IDirect3DVertexBuffer8(iface);
}
static inline IDirect3DIndexBuffer8Impl *impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBuffer8 *iface)
{
return CONTAINING_RECORD(iface, IDirect3DIndexBuffer8Impl, IDirect3DIndexBuffer8_iface);

View File

@ -277,6 +277,7 @@ struct IDirect3DVertexBuffer8Impl
HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Impl *device,
UINT size, DWORD usage, DWORD fvf, D3DPOOL pool) DECLSPEC_HIDDEN;
IDirect3DVertexBuffer8Impl *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVertexBuffer8 *iface) DECLSPEC_HIDDEN;
/* --------------------- */
/* IDirect3DIndexBuffer8 */

View File

@ -2005,8 +2005,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ProcessVertices(IDirect3DDevice8 *ifa
DWORD Flags)
{
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
IDirect3DVertexBuffer8Impl *dest = unsafe_impl_from_IDirect3DVertexBuffer8(pDestBuffer);
HRESULT hr;
IDirect3DVertexBuffer8Impl *dest = (IDirect3DVertexBuffer8Impl *) pDestBuffer;
TRACE("iface %p, src_start_idx %u, dst_idx %u, vertex_count %u, dst_buffer %p, flags %#x.\n",
iface, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, Flags);
@ -2683,6 +2683,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(IDirect3DDevice8 *ifa
UINT StreamNumber, IDirect3DVertexBuffer8 *pStreamData, UINT Stride)
{
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
IDirect3DVertexBuffer8Impl *streamdata = unsafe_impl_from_IDirect3DVertexBuffer8(pStreamData);
HRESULT hr;
TRACE("iface %p, stream_idx %u, buffer %p, stride %u.\n",
@ -2690,8 +2691,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(IDirect3DDevice8 *ifa
wined3d_mutex_lock();
hr = wined3d_device_set_stream_source(This->wined3d_device, StreamNumber,
pStreamData ? ((IDirect3DVertexBuffer8Impl *)pStreamData)->wineD3DVertexBuffer : NULL,
0/* Offset in bytes */, Stride);
streamdata ? streamdata->wineD3DVertexBuffer : NULL, 0/* Offset in bytes */, Stride);
wined3d_mutex_unlock();
return hr;