Henri Verbeet : wined3d: IWineD3DSurface_GetDesc() should never fail.

Alexandre Julliard julliard at winehq.org
Wed Sep 8 13:32:12 CDT 2010


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Sep  8 11:24:47 2010 +0200

wined3d: IWineD3DSurface_GetDesc() should never fail.

---

 dlls/d3d8/surface.c            |   24 ++++++++++--------------
 dlls/d3d9/surface.c            |   24 ++++++++++--------------
 dlls/ddraw/ddraw.c             |    3 +--
 dlls/ddraw/surface.c           |    8 +-------
 dlls/wined3d/cubetexture.c     |    4 +++-
 dlls/wined3d/surface_base.c    |    4 +---
 dlls/wined3d/texture.c         |    4 +++-
 dlls/wined3d/wined3d_private.h |    2 +-
 include/wine/wined3d.idl       |    2 +-
 9 files changed, 31 insertions(+), 44 deletions(-)

diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c
index a71ab12..6e59bd6 100644
--- a/dlls/d3d8/surface.c
+++ b/dlls/d3d8/surface.c
@@ -190,27 +190,23 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(LPDIRECT3DSURFACE8 ifac
 static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(LPDIRECT3DSURFACE8 iface, D3DSURFACE_DESC *pDesc) {
     IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface;
     WINED3DSURFACE_DESC    wined3ddesc;
-    HRESULT hr;
 
     TRACE("iface %p, desc %p.\n", iface, pDesc);
 
     wined3d_mutex_lock();
-    hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
+    IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
     wined3d_mutex_unlock();
 
-    if (SUCCEEDED(hr))
-    {
-        pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.format);
-        pDesc->Type = wined3ddesc.resource_type;
-        pDesc->Usage = wined3ddesc.usage;
-        pDesc->Pool = wined3ddesc.pool;
-        pDesc->Size = wined3ddesc.size;
-        pDesc->MultiSampleType = wined3ddesc.multisample_type;
-        pDesc->Width = wined3ddesc.width;
-        pDesc->Height = wined3ddesc.height;
-    }
+    pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.format);
+    pDesc->Type = wined3ddesc.resource_type;
+    pDesc->Usage = wined3ddesc.usage;
+    pDesc->Pool = wined3ddesc.pool;
+    pDesc->Size = wined3ddesc.size;
+    pDesc->MultiSampleType = wined3ddesc.multisample_type;
+    pDesc->Width = wined3ddesc.width;
+    pDesc->Height = wined3ddesc.height;
 
-    return hr;
+    return D3D_OK;
 }
 
 static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKED_RECT *pLockedRect, CONST RECT *pRect, DWORD Flags) {
diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c
index c7dc895..de3fb77 100644
--- a/dlls/d3d9/surface.c
+++ b/dlls/d3d9/surface.c
@@ -246,27 +246,23 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFACE9 ifac
 static HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3DSURFACE_DESC* pDesc) {
     IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
     WINED3DSURFACE_DESC wined3ddesc;
-    HRESULT hr;
 
     TRACE("iface %p, desc %p.\n", iface, pDesc);
 
     wined3d_mutex_lock();
-    hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
+    IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
     wined3d_mutex_unlock();
 
-    if (SUCCEEDED(hr))
-    {
-        pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.format);
-        pDesc->Type = wined3ddesc.resource_type;
-        pDesc->Usage = wined3ddesc.usage;
-        pDesc->Pool = wined3ddesc.pool;
-        pDesc->MultiSampleType = wined3ddesc.multisample_type;
-        pDesc->MultiSampleQuality = wined3ddesc.multisample_quality;
-        pDesc->Width = wined3ddesc.width;
-        pDesc->Height = wined3ddesc.height;
-    }
+    pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.format);
+    pDesc->Type = wined3ddesc.resource_type;
+    pDesc->Usage = wined3ddesc.usage;
+    pDesc->Pool = wined3ddesc.pool;
+    pDesc->MultiSampleType = wined3ddesc.multisample_type;
+    pDesc->MultiSampleQuality = wined3ddesc.multisample_quality;
+    pDesc->Width = wined3ddesc.width;
+    pDesc->Height = wined3ddesc.height;
 
-    return hr;
+    return D3D_OK;
 }
 
 static HRESULT WINAPI IDirect3DSurface9Impl_LockRect(LPDIRECT3DSURFACE9 iface, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 865d5d0..cb942d4 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -2389,8 +2389,7 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
     IWineD3DSurface_GetClipper(wineD3DSurface, &clipper);
 
     /* Get the surface properties */
-    hr = IWineD3DSurface_GetDesc(wineD3DSurface, &Desc);
-    if(hr != D3D_OK) return hr;
+    IWineD3DSurface_GetDesc(wineD3DSurface, &Desc);
 
     Format = Desc.format;
     Usage = Desc.usage;
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index a433913..badd46b 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -3588,13 +3588,7 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
     }
 
     surface->surface_desc.dwFlags |= DDSD_PIXELFORMAT;
-    hr = IWineD3DSurface_GetDesc(surface->WineD3DSurface, &wined3d_desc);
-    if (FAILED(hr))
-    {
-        ERR("Failed to get wined3d surface desc, hr %#x.\n", hr);
-        IWineD3DSurface_Release(surface->WineD3DSurface);
-        return hr;
-    }
+    IWineD3DSurface_GetDesc(surface->WineD3DSurface, &wined3d_desc);
 
     format = wined3d_desc.format;
     if (format == WINED3DFMT_UNKNOWN)
diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index 519efbd..13ec3a8 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -337,7 +337,9 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture *
         return WINED3DERR_INVALIDCALL;
     }
 
-    return IWineD3DSurface_GetDesc(surface, desc);
+    IWineD3DSurface_GetDesc(surface, desc);
+
+    return WINED3D_OK;
 }
 
 static HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeTexture *iface,
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index eb64804..172b8a8 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -146,7 +146,7 @@ void * WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface)
     return ((IWineD3DSurfaceImpl *)iface)->resource.parent;
 }
 
-HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *desc)
+void WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *desc)
 {
     IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface;
 
@@ -161,8 +161,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSU
     desc->multisample_quality = surface->currentDesc.MultiSampleQuality;
     desc->width = surface->currentDesc.Width;
     desc->height = surface->currentDesc.Height;
-
-    return WINED3D_OK;
 }
 
 HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetBltStatus(IWineD3DSurface *iface, DWORD Flags)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 8e285f7..a52d7c4 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -353,7 +353,9 @@ static HRESULT WINAPI IWineD3DTextureImpl_GetLevelDesc(IWineD3DTexture *iface, U
         return WINED3DERR_INVALIDCALL;
     }
 
-    return IWineD3DSurface_GetDesc(surface, desc);
+    IWineD3DSurface_GetDesc(surface, desc);
+
+    return WINED3D_OK;
 }
 
 static HRESULT WINAPI IWineD3DTextureImpl_GetSurfaceLevel(IWineD3DTexture *iface,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 30a5ea5..d9e6e83 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2151,7 +2151,7 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_FreePrivateData(IWineD3DSurface *iface, R
 DWORD WINAPI IWineD3DBaseSurfaceImpl_SetPriority(IWineD3DSurface *iface, DWORD PriorityNew) DECLSPEC_HIDDEN;
 DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPriority(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
 WINED3DRESOURCETYPE WINAPI IWineD3DBaseSurfaceImpl_GetType(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
-HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *desc) DECLSPEC_HIDDEN;
+void WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *desc) DECLSPEC_HIDDEN;
 HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetBltStatus(IWineD3DSurface *iface, DWORD Flags) DECLSPEC_HIDDEN;
 HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetFlipStatus(IWineD3DSurface *iface, DWORD Flags) DECLSPEC_HIDDEN;
 HRESULT WINAPI IWineD3DBaseSurfaceImpl_IsLost(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index 942ecdc..36a82a5 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -2373,7 +2373,7 @@ interface IWineD3DClipper : IUnknown
 ]
 interface IWineD3DSurface : IWineD3DResource
 {
-    HRESULT GetDesc(
+    void GetDesc(
         [out] WINED3DSURFACE_DESC *desc
     );
     HRESULT LockRect(




More information about the wine-cvs mailing list