d3dx9: Forward D3DXCreateVolumeTextureFromFile functions to D3DXCreateVolumeTextureFromFileInMemoryEx.

This commit is contained in:
Józef Kucia 2012-06-29 14:17:02 +02:00 committed by Alexandre Julliard
parent 07b0f25404
commit fde802a04d
2 changed files with 142 additions and 4 deletions

View File

@ -107,12 +107,12 @@
@ stub D3DXCreateTextureShader(ptr ptr) @ stub D3DXCreateTextureShader(ptr ptr)
@ stub D3DXCreateTorus(ptr long long long long ptr ptr) @ stub D3DXCreateTorus(ptr long long long long ptr ptr)
@ stdcall D3DXCreateVolumeTexture(ptr long long long long long long long ptr) @ stdcall D3DXCreateVolumeTexture(ptr long long long long long long long ptr)
@ stub D3DXCreateVolumeTextureFromFileA(ptr ptr ptr) @ stdcall D3DXCreateVolumeTextureFromFileA(ptr ptr ptr)
@ stub D3DXCreateVolumeTextureFromFileExA(ptr ptr long long long long long long long long long long ptr ptr ptr) @ stdcall D3DXCreateVolumeTextureFromFileExA(ptr ptr long long long long long long long long long long ptr ptr ptr)
@ stub D3DXCreateVolumeTextureFromFileExW(ptr ptr long long long long long long long long long long ptr ptr ptr) @ stdcall D3DXCreateVolumeTextureFromFileExW(ptr ptr long long long long long long long long long long ptr ptr ptr)
@ stdcall D3DXCreateVolumeTextureFromFileInMemory(ptr ptr long ptr) @ stdcall D3DXCreateVolumeTextureFromFileInMemory(ptr ptr long ptr)
@ stdcall D3DXCreateVolumeTextureFromFileInMemoryEx(ptr ptr long long long long long long long long long long long ptr ptr ptr) @ stdcall D3DXCreateVolumeTextureFromFileInMemoryEx(ptr ptr long long long long long long long long long long long ptr ptr ptr)
@ stub D3DXCreateVolumeTextureFromFileW(ptr ptr ptr) @ stdcall D3DXCreateVolumeTextureFromFileW(ptr ptr ptr)
@ stub D3DXCreateVolumeTextureFromResourceA(ptr long ptr ptr) @ stub D3DXCreateVolumeTextureFromResourceA(ptr long ptr ptr)
@ stub D3DXCreateVolumeTextureFromResourceExA(ptr long ptr long long long long long long long long long long ptr ptr ptr) @ stub D3DXCreateVolumeTextureFromResourceExA(ptr long ptr long long long long long long long long long long ptr ptr ptr)
@ stub D3DXCreateVolumeTextureFromResourceExW(ptr long ptr long long long long long long long long long long ptr ptr ptr) @ stub D3DXCreateVolumeTextureFromResourceExW(ptr long ptr long long long long long long long long long long ptr ptr ptr)

View File

@ -977,6 +977,144 @@ HRESULT WINAPI D3DXCreateVolumeTexture(LPDIRECT3DDEVICE9 device,
usage, format, pool, texture, NULL); usage, format, pool, texture, NULL);
} }
HRESULT WINAPI D3DXCreateVolumeTextureFromFileA(IDirect3DDevice9 *device,
const char *filename,
IDirect3DVolumeTexture9 **volume_texture)
{
int len;
HRESULT hr;
void *data;
DWORD data_size;
WCHAR *filenameW;
TRACE("(%p, %s, %p): relay\n",
device, debugstr_a(filename), volume_texture);
if (!filename) return D3DERR_INVALIDCALL;
len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0);
filenameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!filenameW) return E_OUTOFMEMORY;
MultiByteToWideChar(CP_ACP, 0, filename, -1, filenameW, len);
hr = map_view_of_file(filenameW, &data, &data_size);
HeapFree(GetProcessHeap(), 0, filenameW);
if (FAILED(hr)) return D3DXERR_INVALIDDATA;
hr = D3DXCreateVolumeTextureFromFileInMemoryEx(device, data, data_size, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT,
D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, volume_texture);
UnmapViewOfFile(data);
return hr;
}
HRESULT WINAPI D3DXCreateVolumeTextureFromFileW(IDirect3DDevice9 *device,
const WCHAR *filename,
IDirect3DVolumeTexture9 **volume_texture)
{
HRESULT hr;
void *data;
DWORD data_size;
TRACE("(%p, %s, %p): relay\n",
device, debugstr_w(filename), volume_texture);
if (!filename) return D3DERR_INVALIDCALL;
hr = map_view_of_file(filename, &data, &data_size);
if (FAILED(hr)) return D3DXERR_INVALIDDATA;
hr = D3DXCreateVolumeTextureFromFileInMemoryEx(device, data, data_size, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT,
D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, volume_texture);
UnmapViewOfFile(data);
return hr;
}
HRESULT WINAPI D3DXCreateVolumeTextureFromFileExA(IDirect3DDevice9 *device,
const char *filename,
UINT width,
UINT height,
UINT depth,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
DWORD filter,
DWORD mip_filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO *src_info,
PALETTEENTRY *palette,
IDirect3DVolumeTexture9 **volume_texture)
{
int len;
HRESULT hr;
WCHAR *filenameW;
void *data;
DWORD data_size;
TRACE("(%p, %s, %u, %u, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p): relay\n",
device, debugstr_a(filename), width, height, depth, mip_levels,
usage, format, pool, filter, mip_filter, color_key, src_info,
palette, volume_texture);
if (!filename) return D3DERR_INVALIDCALL;
len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0);
filenameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (!filenameW) return E_OUTOFMEMORY;
MultiByteToWideChar(CP_ACP, 0, filename, -1, filenameW, len);
hr = map_view_of_file(filenameW, &data, &data_size);
HeapFree(GetProcessHeap(), 0, filenameW);
if (FAILED(hr)) return D3DXERR_INVALIDDATA;
hr = D3DXCreateVolumeTextureFromFileInMemoryEx(device, data, data_size, width, height, depth,
mip_levels, usage, format, pool, filter, mip_filter, color_key, src_info, palette,
volume_texture);
UnmapViewOfFile(data);
return hr;
}
HRESULT WINAPI D3DXCreateVolumeTextureFromFileExW(IDirect3DDevice9 *device,
const WCHAR *filename,
UINT width,
UINT height,
UINT depth,
UINT mip_levels,
DWORD usage,
D3DFORMAT format,
D3DPOOL pool,
DWORD filter,
DWORD mip_filter,
D3DCOLOR color_key,
D3DXIMAGE_INFO *src_info,
PALETTEENTRY *palette,
IDirect3DVolumeTexture9 **volume_texture)
{
HRESULT hr;
void *data;
DWORD data_size;
TRACE("(%p, %s, %u, %u, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p): relay\n",
device, debugstr_w(filename), width, height, depth, mip_levels,
usage, format, pool, filter, mip_filter, color_key, src_info,
palette, volume_texture);
if (!filename) return D3DERR_INVALIDCALL;
hr = map_view_of_file(filename, &data, &data_size);
if (FAILED(hr)) return D3DXERR_INVALIDDATA;
hr = D3DXCreateVolumeTextureFromFileInMemoryEx(device, data, data_size, width, height, depth,
mip_levels, usage, format, pool, filter, mip_filter, color_key, src_info, palette,
volume_texture);
UnmapViewOfFile(data);
return hr;
}
HRESULT WINAPI D3DXCreateVolumeTextureFromFileInMemory(IDirect3DDevice9 *device, HRESULT WINAPI D3DXCreateVolumeTextureFromFileInMemory(IDirect3DDevice9 *device,
const void *data, const void *data,
UINT data_size, UINT data_size,