Commit 3cedef2f authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d8: Simplify GetDevice().

We already store "parentDevice", so we might as well use it.
parent 1f6d2456
......@@ -82,23 +82,18 @@ static ULONG WINAPI IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 ifa
}
/* IDirect3DCubeTexture8 IDirect3DResource8 Interface follow: */
static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetDevice(LPDIRECT3DCUBETEXTURE8 iface, IDirect3DDevice8 **ppDevice) {
static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetDevice(IDirect3DCubeTexture8 *iface, IDirect3DDevice8 **device)
{
IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("iface %p, device %p.\n", iface, ppDevice);
TRACE("iface %p, device %p.\n", iface, device);
wined3d_mutex_lock();
hr = IWineD3DCubeTexture_GetDevice(This->wineD3DCubeTexture, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
wined3d_mutex_unlock();
*device = (IDirect3DDevice8 *)This->parentDevice;
IDirect3DDevice8_AddRef(*device);
return hr;
TRACE("Returning device %p.\n", *device);
return D3D_OK;
}
static HRESULT WINAPI IDirect3DCubeTexture8Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
......
......@@ -79,23 +79,18 @@ static ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 ifa
}
/* IDirect3DIndexBuffer8 IDirect3DResource8 Interface follow: */
static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDevice(LPDIRECT3DINDEXBUFFER8 iface, IDirect3DDevice8 **ppDevice) {
static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDevice(IDirect3DIndexBuffer8 *iface, IDirect3DDevice8 **device)
{
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("iface %p, device %p.\n", iface, ppDevice);
TRACE("iface %p, device %p.\n", iface, device);
wined3d_mutex_lock();
hr = IWineD3DBuffer_GetDevice(This->wineD3DIndexBuffer, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
wined3d_mutex_unlock();
*device = (IDirect3DDevice8 *)This->parentDevice;
IDirect3DDevice8_AddRef(*device);
return hr;
TRACE("Returning device %p.\n", *device);
return D3D_OK;
}
static HRESULT WINAPI IDirect3DIndexBuffer8Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
......
......@@ -100,23 +100,18 @@ static ULONG WINAPI IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface) {
}
/* IDirect3DSurface8 IDirect3DResource8 Interface follow: */
static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(LPDIRECT3DSURFACE8 iface, IDirect3DDevice8 **ppDevice) {
static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(IDirect3DSurface8 *iface, IDirect3DDevice8 **device)
{
IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("iface %p, device %p.\n", iface, ppDevice);
TRACE("iface %p, device %p.\n", iface, device);
wined3d_mutex_lock();
hr = IWineD3DSurface_GetDevice(This->wineD3DSurface, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
wined3d_mutex_unlock();
*device = (IDirect3DDevice8 *)This->parentDevice;
IDirect3DDevice8_AddRef(*device);
return hr;
TRACE("Returning device %p.\n", *device);
return D3D_OK;
}
static HRESULT WINAPI IDirect3DSurface8Impl_SetPrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) {
......
......@@ -80,23 +80,18 @@ static ULONG WINAPI IDirect3DTexture8Impl_Release(LPDIRECT3DTEXTURE8 iface) {
}
/* IDirect3DTexture8 IDirect3DResource8 Interface follow: */
static HRESULT WINAPI IDirect3DTexture8Impl_GetDevice(LPDIRECT3DTEXTURE8 iface, IDirect3DDevice8 **ppDevice) {
static HRESULT WINAPI IDirect3DTexture8Impl_GetDevice(IDirect3DTexture8 *iface, IDirect3DDevice8 **device)
{
IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("iface %p, device %p.\n", iface, ppDevice);
TRACE("iface %p, device %p.\n", iface, device);
wined3d_mutex_lock();
hr = IWineD3DTexture_GetDevice(This->wineD3DTexture, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
wined3d_mutex_unlock();
*device = (IDirect3DDevice8 *)This->parentDevice;
IDirect3DDevice8_AddRef(*device);
return hr;
TRACE("Returning device %p.\n", *device);
return D3D_OK;
}
static HRESULT WINAPI IDirect3DTexture8Impl_SetPrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) {
......
......@@ -81,23 +81,18 @@ static ULONG WINAPI IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 i
}
/* IDirect3DVertexBuffer8 IDirect3DResource8 Interface follow: */
static HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDevice(LPDIRECT3DVERTEXBUFFER8 iface, IDirect3DDevice8 **ppDevice) {
static HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDevice(IDirect3DVertexBuffer8 *iface, IDirect3DDevice8 **device)
{
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("iface %p, device %p.\n", iface, ppDevice);
TRACE("iface %p, device %p.\n", iface, device);
wined3d_mutex_lock();
hr = IWineD3DBuffer_GetDevice(This->wineD3DVertexBuffer, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
wined3d_mutex_unlock();
*device = (IDirect3DDevice8 *)This->parentDevice;
IDirect3DDevice8_AddRef(*device);
return hr;
TRACE("Returning device %p.\n", *device);
return D3D_OK;
}
static HRESULT WINAPI IDirect3DVertexBuffer8Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) {
......
......@@ -80,23 +80,18 @@ static ULONG WINAPI IDirect3DVolumeTexture8Impl_Release(LPDIRECT3DVOLUMETEXTURE8
}
/* IDirect3DVolumeTexture8 IDirect3DResource8 Interface follow: */
static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetDevice(LPDIRECT3DVOLUMETEXTURE8 iface, IDirect3DDevice8 **ppDevice) {
static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetDevice(IDirect3DVolumeTexture8 *iface, IDirect3DDevice8 **device)
{
IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("iface %p, device %p.\n", iface, ppDevice);
TRACE("iface %p, device %p.\n", iface, device);
wined3d_mutex_lock();
hr = IWineD3DVolumeTexture_GetDevice(This->wineD3DVolumeTexture, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
wined3d_mutex_unlock();
*device = (IDirect3DDevice8 *)This->parentDevice;
IDirect3DDevice8_AddRef(*device);
return hr;
TRACE("Returning device %p.\n", *device);
return D3D_OK;
}
static HRESULT WINAPI IDirect3DVolumeTexture8Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment