d3dx9: Simplify D3DXCreateTextureFromResourceExA().
This commit is contained in:
parent
805fc64198
commit
4b56eae0f1
|
@ -785,34 +785,27 @@ HRESULT WINAPI D3DXCreateTextureFromResourceExA(struct IDirect3DDevice9 *device,
|
||||||
PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
|
PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
|
||||||
{
|
{
|
||||||
HRSRC resinfo;
|
HRSRC resinfo;
|
||||||
|
void *buffer;
|
||||||
|
DWORD size;
|
||||||
|
|
||||||
TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(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_a(resource), width, height, miplevels, usage, format,
|
||||||
|
pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
|
||||||
|
|
||||||
if (!device || !texture)
|
if (!device || !texture)
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
resinfo = FindResourceA(srcmodule, resource, (const char *)RT_RCDATA);
|
if (!(resinfo = FindResourceA(srcmodule, resource, (const char *)RT_RCDATA))
|
||||||
if (!resinfo) /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
|
/* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
|
||||||
resinfo = FindResourceA(srcmodule, resource, (const char *)RT_BITMAP);
|
&& !(resinfo = FindResourceA(srcmodule, resource, (const char *)RT_BITMAP)))
|
||||||
|
return D3DXERR_INVALIDDATA;
|
||||||
|
|
||||||
if (resinfo)
|
if (FAILED(load_resource_into_memory(srcmodule, resinfo, &buffer, &size)))
|
||||||
{
|
return D3DXERR_INVALIDDATA;
|
||||||
LPVOID buffer;
|
|
||||||
HRESULT hr;
|
|
||||||
DWORD size;
|
|
||||||
|
|
||||||
hr = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
|
return D3DXCreateTextureFromFileInMemoryEx(device, buffer, size, width, height, miplevels,
|
||||||
|
usage, format, pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
|
||||||
if (FAILED(hr))
|
|
||||||
return D3DXERR_INVALIDDATA;
|
|
||||||
|
|
||||||
return D3DXCreateTextureFromFileInMemoryEx(device, buffer, size, width,
|
|
||||||
height, miplevels, usage, format,
|
|
||||||
pool, filter, mipfilter, colorkey,
|
|
||||||
srcinfo, palette, texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
return D3DXERR_INVALIDDATA;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI D3DXCreateTextureFromResourceExW(struct IDirect3DDevice9 *device, HMODULE srcmodule,
|
HRESULT WINAPI D3DXCreateTextureFromResourceExW(struct IDirect3DDevice9 *device, HMODULE srcmodule,
|
||||||
|
|
Loading…
Reference in New Issue