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

Alexandre Julliard julliard at winehq.org
Mon Mar 14 14:29:35 CDT 2011


Module: wine
Branch: master
Commit: 3ac924a2da111fe553ebe1e28312c281256a0baf
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3ac924a2da111fe553ebe1e28312c281256a0baf

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Sun Mar 13 20:54:30 2011 +0100

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

---

 dlls/d3d8/cubetexture.c    |   18 +++++++++++-------
 dlls/d3d9/cubetexture.c    |   16 ++++++++++------
 dlls/wined3d/cubetexture.c |   20 --------------------
 include/wine/wined3d.idl   |    6 ------
 4 files changed, 21 insertions(+), 39 deletions(-)

diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c
index 515be63..891042e 100644
--- a/dlls/d3d8/cubetexture.c
+++ b/dlls/d3d8/cubetexture.c
@@ -306,20 +306,24 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(IDirect3DCubeT
 }
 
 static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(IDirect3DCubeTexture8 *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)
 {
-    IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface);
+    IDirect3DCubeTexture8Impl *texture = impl_from_IDirect3DCubeTexture8(iface);
+    struct wined3d_resource *sub_resource;
     UINT sub_resource_idx;
     HRESULT hr;
 
     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();
-    sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level;
-    hr = IWineD3DCubeTexture_Map(This->wineD3DCubeTexture, sub_resource_idx,
-            (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags);
+    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_LockRect((IDirect3DSurface8 *)wined3d_resource_get_parent(sub_resource),
+                locked_rect, rect, flags);
     wined3d_mutex_unlock();
 
     return hr;
diff --git a/dlls/d3d9/cubetexture.c b/dlls/d3d9/cubetexture.c
index f6cacd9..87d00c1 100644
--- a/dlls/d3d9/cubetexture.c
+++ b/dlls/d3d9/cubetexture.c
@@ -322,19 +322,23 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(IDirect3DCubeT
 }
 
 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;
     HRESULT hr;
 
     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();
-    sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture) * FaceType + Level;
-    hr = IWineD3DCubeTexture_Map(This->wineD3DCubeTexture, sub_resource_idx,
-            (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags);
+    sub_resource_idx = IWineD3DCubeTexture_GetLevelCount(texture->wineD3DCubeTexture) * face + level;
+    if (!(sub_resource = IWineD3DCubeTexture_GetSubResource(texture->wineD3DCubeTexture, sub_resource_idx)))
+        hr = D3DERR_INVALIDCALL;
+    else
+        hr = IDirect3DSurface9_LockRect((IDirect3DSurface9 *)wined3d_resource_get_parent(sub_resource),
+                locked_rect, rect, flags);
     wined3d_mutex_unlock();
 
     return hr;
diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index 4031162..b5294dd 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -336,25 +336,6 @@ static struct wined3d_resource * WINAPI IWineD3DCubeTextureImpl_GetSubResource(I
     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,
         UINT sub_resource_idx)
 {
@@ -420,7 +401,6 @@ static const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
     IWineD3DCubeTextureImpl_IsCondNP2,
     IWineD3DCubeTextureImpl_GetSubResource,
     /* IWineD3DCubeTexture */
-    IWineD3DCubeTextureImpl_Map,
     IWineD3DCubeTextureImpl_Unmap,
     IWineD3DCubeTextureImpl_AddDirtyRect
 };
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index a74b941..83e0479 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -2382,12 +2382,6 @@ interface IWineD3DTexture : 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(
         [in] UINT sub_resource_idx
     );




More information about the wine-cvs mailing list