Henri Verbeet : d3dx9: Simplify D3DXCreateTextureFromResourceExW().

Alexandre Julliard julliard at winehq.org
Thu Aug 29 13:18:14 CDT 2013


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Aug 29 10:26:27 2013 +0200

d3dx9: Simplify D3DXCreateTextureFromResourceExW().

---

 dlls/d3dx9_36/texture.c |   35 ++++++++++++++---------------------
 1 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c
index d32d834..f0b5569 100644
--- a/dlls/d3dx9_36/texture.c
+++ b/dlls/d3dx9_36/texture.c
@@ -814,34 +814,27 @@ HRESULT WINAPI D3DXCreateTextureFromResourceExW(struct IDirect3DDevice9 *device,
         PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
 {
     HRSRC resinfo;
+    void *buffer;
+    DWORD size;
 
-    TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(resource));
+    TRACE("device %p, srcmodule %p, resource %s, width %u, height %u, miplevels %u, usage %#x, format %#x, "
+            "pool %#x, filter %#x, mipfilter %#x, colorkey 0x%08x, srcinfo %p, palette %p, texture %p.\n",
+            device, srcmodule, debugstr_w(resource), width, height, miplevels, usage, format,
+            pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
 
     if (!device || !texture)
         return D3DERR_INVALIDCALL;
 
-    resinfo = FindResourceW(srcmodule, resource, (const WCHAR *)RT_RCDATA);
-    if (!resinfo) /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
-        resinfo = FindResourceW(srcmodule, resource, (const WCHAR *)RT_BITMAP);
-
-    if (resinfo)
-    {
-        LPVOID buffer;
-        HRESULT hr;
-        DWORD size;
-
-        hr = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
-
-        if (FAILED(hr))
-            return D3DXERR_INVALIDDATA;
+    if (!(resinfo = FindResourceW(srcmodule, resource, (const WCHAR *)RT_RCDATA))
+            /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
+            && !(resinfo = FindResourceW(srcmodule, resource, (const WCHAR *)RT_BITMAP)))
+        return D3DXERR_INVALIDDATA;
 
-        return D3DXCreateTextureFromFileInMemoryEx(device, buffer, size, width,
-                                                   height, miplevels, usage, format,
-                                                   pool, filter, mipfilter, colorkey,
-                                                   srcinfo, palette, texture);
-    }
+    if (FAILED(load_resource_into_memory(srcmodule, resinfo, &buffer, &size)))
+        return D3DXERR_INVALIDDATA;
 
-    return D3DXERR_INVALIDDATA;
+    return D3DXCreateTextureFromFileInMemoryEx(device, buffer, size, width, height, miplevels,
+            usage, format, pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
 }
 
 HRESULT WINAPI D3DXCreateCubeTexture(struct IDirect3DDevice9 *device, UINT size, UINT miplevels,




More information about the wine-cvs mailing list