wined3d: Get rid of IWineD3DCubeTexture::Map().

This commit is contained in:
Henri Verbeet 2011-03-13 20:54:30 +01:00 committed by Alexandre Julliard
parent 13b05b9dbe
commit 3ac924a2da
4 changed files with 21 additions and 39 deletions

View File

@ -306,20 +306,24 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(IDirect3DCubeT
} }
static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(IDirect3DCubeTexture8 *iface, static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(IDirect3DCubeTexture8 *iface,
D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT *pLockedRect, const RECT *pRect, D3DCUBEMAP_FACES face, UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect,
DWORD Flags) DWORD flags)
{ {
IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); IDirect3DCubeTexture8Impl *texture = impl_from_IDirect3DCubeTexture8(iface);
struct wined3d_resource *sub_resource;
UINT sub_resource_idx; UINT sub_resource_idx;
HRESULT hr; HRESULT hr;
TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n", TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n",
iface, FaceType, Level, pLockedRect, pRect, Flags); iface, face, level, locked_rect, rect, flags);
wined3d_mutex_lock(); wined3d_mutex_lock();
sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level; sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(texture->wineD3DCubeTexture) * face + level;
hr = IWineD3DCubeTexture_Map(This->wineD3DCubeTexture, sub_resource_idx, if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, sub_resource_idx)))
(WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags); hr = D3DERR_INVALIDCALL;
else
hr = IDirect3DSurface8_LockRect((IDirect3DSurface8 *)wined3d_resource_get_parent(sub_resource),
locked_rect, rect, flags);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;

View File

@ -322,19 +322,23 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(IDirect3DCubeT
} }
static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(IDirect3DCubeTexture9 *iface, static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(IDirect3DCubeTexture9 *iface,
D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags) D3DCUBEMAP_FACES face, UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
{ {
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; IDirect3DCubeTexture9Impl *texture = (IDirect3DCubeTexture9Impl *)iface;
struct wined3d_resource *sub_resource;
UINT sub_resource_idx; UINT sub_resource_idx;
HRESULT hr; HRESULT hr;
TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n", TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n",
iface, FaceType, Level, pLockedRect, pRect, Flags); iface, face, level, locked_rect, rect, flags);
wined3d_mutex_lock(); wined3d_mutex_lock();
sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level; sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(texture->wineD3DCubeTexture) * face + level;
hr = IWineD3DCubeTexture_Map(This->wineD3DCubeTexture, sub_resource_idx, if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, sub_resource_idx)))
(WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags); hr = D3DERR_INVALIDCALL;
else
hr = IDirect3DSurface9_LockRect((IDirect3DSurface9 *)wined3d_resource_get_parent(sub_resource),
locked_rect, rect, flags);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;

View File

@ -336,25 +336,6 @@ static struct wined3d_resource * WINAPI IWineD3DCubeTextureImpl_GetSubResource(I
return basetexture_get_sub_resource(texture, sub_resource_idx); return basetexture_get_sub_resource(texture, sub_resource_idx);
} }
static HRESULT WINAPI IWineD3DCubeTextureImpl_Map(IWineD3DCubeTexture *iface,
UINT sub_resource_idx, WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
{
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
struct wined3d_resource *sub_resource;
TRACE("iface %p, sub_resource_idx %u, locked_rect %p, rect %s, flags %#x.\n",
iface, sub_resource_idx, locked_rect, wine_dbgstr_rect(rect), flags);
if (!(sub_resource = basetexture_get_sub_resource(texture, sub_resource_idx)))
{
WARN("Failed to get sub-resource.\n");
return WINED3DERR_INVALIDCALL;
}
return IWineD3DSurface_Map((IWineD3DSurface *)surface_from_resource(sub_resource),
locked_rect, rect, flags);
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_Unmap(IWineD3DCubeTexture *iface, static HRESULT WINAPI IWineD3DCubeTextureImpl_Unmap(IWineD3DCubeTexture *iface,
UINT sub_resource_idx) UINT sub_resource_idx)
{ {
@ -420,7 +401,6 @@ static const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
IWineD3DCubeTextureImpl_IsCondNP2, IWineD3DCubeTextureImpl_IsCondNP2,
IWineD3DCubeTextureImpl_GetSubResource, IWineD3DCubeTextureImpl_GetSubResource,
/* IWineD3DCubeTexture */ /* IWineD3DCubeTexture */
IWineD3DCubeTextureImpl_Map,
IWineD3DCubeTextureImpl_Unmap, IWineD3DCubeTextureImpl_Unmap,
IWineD3DCubeTextureImpl_AddDirtyRect IWineD3DCubeTextureImpl_AddDirtyRect
}; };

View File

@ -2382,12 +2382,6 @@ interface IWineD3DTexture : IWineD3DBaseTexture
] ]
interface IWineD3DCubeTexture : IWineD3DBaseTexture interface IWineD3DCubeTexture : IWineD3DBaseTexture
{ {
HRESULT Map(
[in] UINT sub_resource_idx,
[out] WINED3DLOCKED_RECT *locked_rect,
[in] const RECT *rect,
[in] DWORD flags
);
HRESULT Unmap( HRESULT Unmap(
[in] UINT sub_resource_idx [in] UINT sub_resource_idx
); );