static HRESULT WINAPI IDirect3DTexture8Impl_UnlockRect(IDirect3DTexture8 *iface, UINT level) { IDirect3DTexture8Impl *texture = impl_from_IDirect3DTexture8(iface); struct wined3d_resource *sub_resource; HRESULT hr; TRACE("iface %p, level %u.\n", iface, level); wined3d_mutex_lock(); if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) hr = D3DERR_INVALIDCALL; else hr = IDirect3DSurface8_UnlockRect((IDirect3DSurface8 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; }
static HRESULT WINAPI IDirect3DCubeTexture8Impl_UnlockRect(IDirect3DCubeTexture8 *iface, D3DCUBEMAP_FACES face, UINT level) { IDirect3DCubeTexture8Impl *texture = impl_from_IDirect3DCubeTexture8(iface); struct wined3d_resource *sub_resource; UINT sub_resource_idx; HRESULT hr; TRACE("iface %p, face %#x, level %u.\n", iface, face, level); wined3d_mutex_lock(); sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(texture->wineD3DCubeTexture) * face + level; if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, sub_resource_idx))) hr = D3DERR_INVALIDCALL; else hr = IDirect3DSurface8_UnlockRect((IDirect3DSurface8 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; }
static HRESULT WINAPI d3d8_texture_2d_UnlockRect(IDirect3DTexture8 *iface, UINT level) { struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); struct wined3d_resource *sub_resource; struct d3d8_surface *surface_impl; HRESULT hr; TRACE("iface %p, level %u.\n", iface, level); wined3d_mutex_lock(); if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) hr = D3DERR_INVALIDCALL; else { surface_impl = wined3d_resource_get_parent(sub_resource); hr = IDirect3DSurface8_UnlockRect(&surface_impl->IDirect3DSurface8_iface); } wined3d_mutex_unlock(); return hr; }
static HRESULT WINAPI d3d8_texture_cube_UnlockRect(IDirect3DCubeTexture8 *iface, D3DCUBEMAP_FACES face, UINT level) { struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); struct wined3d_resource *sub_resource; struct d3d8_surface *surface_impl; UINT sub_resource_idx; HRESULT hr; TRACE("iface %p, face %#x, level %u.\n", iface, face, level); wined3d_mutex_lock(); sub_resource_idx = wined3d_texture_get_level_count(texture->wined3d_texture) * face + level; if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx))) hr = D3DERR_INVALIDCALL; else { surface_impl = wined3d_resource_get_parent(sub_resource); hr = IDirect3DSurface8_UnlockRect(&surface_impl->IDirect3DSurface8_iface); } wined3d_mutex_unlock(); return hr; }