From 13b05b9dbecbb8bd73dc4aa8c0c4899a12901c25 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 13 Mar 2011 20:54:29 +0100 Subject: [PATCH] wined3d: Get rid of IWineD3DTexture::Unmap(). --- dlls/d3d8/texture.c | 12 ++++++++---- dlls/d3d9/texture.c | 13 +++++++++---- dlls/wined3d/texture.c | 17 ----------------- include/wine/wined3d.idl | 3 --- 4 files changed, 17 insertions(+), 28 deletions(-) diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c index ebab8a0372..d153b8f2a6 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -321,15 +321,19 @@ static HRESULT WINAPI IDirect3DTexture8Impl_LockRect(IDirect3DTexture8 *iface, U return hr; } -static HRESULT WINAPI IDirect3DTexture8Impl_UnlockRect(IDirect3DTexture8 *iface, UINT Level) +static HRESULT WINAPI IDirect3DTexture8Impl_UnlockRect(IDirect3DTexture8 *iface, UINT level) { - IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); + IDirect3DTexture8Impl *texture = impl_from_IDirect3DTexture8(iface); + struct wined3d_resource *sub_resource; HRESULT hr; - TRACE("iface %p, level %u.\n", iface, Level); + TRACE("iface %p, level %u.\n", iface, level); wined3d_mutex_lock(); - hr = IWineD3DTexture_Unmap(This->wineD3DTexture, Level); + if (!(sub_resource = IWineD3DTexture_GetSubResource(texture->wineD3DTexture, level))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DSurface8_UnlockRect((IDirect3DSurface8 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index fa84116544..9816bfb4fe 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -336,14 +336,19 @@ static HRESULT WINAPI IDirect3DTexture9Impl_LockRect(IDirect3DTexture9 *iface, return hr; } -static HRESULT WINAPI IDirect3DTexture9Impl_UnlockRect(LPDIRECT3DTEXTURE9 iface, UINT Level) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DTexture9Impl_UnlockRect(IDirect3DTexture9 *iface, UINT level) +{ + IDirect3DTexture9Impl *texture = (IDirect3DTexture9Impl *)iface; + struct wined3d_resource *sub_resource; HRESULT hr; - TRACE("iface %p, level %u.\n", iface, Level); + TRACE("iface %p, level %u.\n", iface, level); wined3d_mutex_lock(); - hr = IWineD3DTexture_Unmap(This->wineD3DTexture, Level); + if (!(sub_resource = IWineD3DTexture_GetSubResource(texture->wineD3DTexture, level))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DSurface9_UnlockRect((IDirect3DSurface9 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 8fe488330d..99446b6c7b 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -361,22 +361,6 @@ static struct wined3d_resource * WINAPI IWineD3DTextureImpl_GetSubResource(IWine return basetexture_get_sub_resource(texture, sub_resource_idx); } -static HRESULT WINAPI IWineD3DTextureImpl_Unmap(IWineD3DTexture *iface, UINT sub_resource_idx) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - struct wined3d_resource *sub_resource; - - TRACE("iface %p, sub_resource_idx %u.\n", iface, sub_resource_idx); - - if (!(sub_resource = basetexture_get_sub_resource(texture, sub_resource_idx))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - return IWineD3DSurface_Unmap((IWineD3DSurface *)surface_from_resource(sub_resource)); -} - static HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRect(IWineD3DTexture *iface, const RECT *dirty_rect) { IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; @@ -421,7 +405,6 @@ static const IWineD3DTextureVtbl IWineD3DTexture_Vtbl = IWineD3DTextureImpl_IsCondNP2, IWineD3DTextureImpl_GetSubResource, /* IWineD3DTexture */ - IWineD3DTextureImpl_Unmap, IWineD3DTextureImpl_AddDirtyRect }; diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl index df4bba79d4..a74b94177b 100644 --- a/include/wine/wined3d.idl +++ b/include/wine/wined3d.idl @@ -2370,9 +2370,6 @@ interface IWineD3DBaseTexture : IWineD3DResource ] interface IWineD3DTexture : IWineD3DBaseTexture { - HRESULT Unmap( - [in] UINT sub_resource_idx - ); HRESULT AddDirtyRect( [in] const RECT *dirty_rect );