d3dx9_36: Add support for RT_BITMAP resource type since it is in DIB format D3DXIFF_DIB.

This commit is contained in:
Christian Costa 2013-01-07 09:40:08 +01:00 committed by Alexandre Julliard
parent 26640c8e7c
commit 4778a5e27d
3 changed files with 31 additions and 51 deletions

View File

@ -878,8 +878,12 @@ HRESULT WINAPI D3DXGetImageInfoFromResourceA(HMODULE module, LPCSTR resource, D3
TRACE("(%p, %s, %p)\n", module, debugstr_a(resource), info);
resinfo = FindResourceA(module, resource, (LPCSTR)RT_RCDATA);
if(resinfo) {
resinfo = FindResourceA(module, resource, (const char *)RT_RCDATA);
if (!resinfo) /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
resinfo = FindResourceA(module, resource, (const char *)RT_BITMAP);
if (resinfo)
{
LPVOID buffer;
HRESULT hr;
DWORD size;
@ -889,11 +893,6 @@ HRESULT WINAPI D3DXGetImageInfoFromResourceA(HMODULE module, LPCSTR resource, D3
return D3DXGetImageInfoFromFileInMemory(buffer, size, info);
}
resinfo = FindResourceA(module, resource, (LPCSTR)RT_BITMAP);
if(resinfo) {
FIXME("Implement loading bitmaps from resource type RT_BITMAP\n");
return E_NOTIMPL;
}
return D3DXERR_INVALIDDATA;
}
@ -903,8 +902,12 @@ HRESULT WINAPI D3DXGetImageInfoFromResourceW(HMODULE module, LPCWSTR resource, D
TRACE("(%p, %s, %p)\n", module, debugstr_w(resource), info);
resinfo = FindResourceW(module, resource, (LPCWSTR)RT_RCDATA);
if(resinfo) {
resinfo = FindResourceW(module, resource, (const WCHAR *)RT_RCDATA);
if (!resinfo) /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
resinfo = FindResourceW(module, resource, (const WCHAR *)RT_BITMAP);
if (resinfo)
{
LPVOID buffer;
HRESULT hr;
DWORD size;
@ -914,11 +917,6 @@ HRESULT WINAPI D3DXGetImageInfoFromResourceW(HMODULE module, LPCWSTR resource, D
return D3DXGetImageInfoFromFileInMemory(buffer, size, info);
}
resinfo = FindResourceW(module, resource, (LPCWSTR)RT_BITMAP);
if(resinfo) {
FIXME("Implement loading bitmaps from resource type RT_BITMAP\n");
return E_NOTIMPL;
}
return D3DXERR_INVALIDDATA;
}
@ -1138,7 +1136,11 @@ HRESULT WINAPI D3DXLoadSurfaceFromResourceA(IDirect3DSurface9 *dst_surface,
if (!dst_surface)
return D3DERR_INVALIDCALL;
if ((hResInfo = FindResourceA(src_module, resource, (const char *)RT_RCDATA)))
hResInfo = FindResourceA(src_module, resource, (const char *)RT_RCDATA);
if (!hResInfo) /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
hResInfo = FindResourceA(src_module, resource, (const char *)RT_BITMAP);
if (hResInfo)
{
UINT data_size;
void *data;
@ -1150,12 +1152,6 @@ HRESULT WINAPI D3DXLoadSurfaceFromResourceA(IDirect3DSurface9 *dst_surface,
data, data_size, src_rect, filter, color_key, src_info);
}
if ((hResInfo = FindResourceA(src_module, resource, (const char *)RT_BITMAP)))
{
FIXME("Implement loading bitmaps from resource type RT_BITMAP.\n");
return E_NOTIMPL;
}
return D3DXERR_INVALIDDATA;
}
@ -1173,7 +1169,11 @@ HRESULT WINAPI D3DXLoadSurfaceFromResourceW(IDirect3DSurface9 *dst_surface,
if (!dst_surface)
return D3DERR_INVALIDCALL;
if ((hResInfo = FindResourceW(src_module, resource, (const WCHAR *)RT_RCDATA)))
hResInfo = FindResourceW(src_module, resource, (const WCHAR *)RT_RCDATA);
if (!hResInfo) /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
hResInfo = FindResourceW(src_module, resource, (const WCHAR *)RT_BITMAP);
if (hResInfo)
{
UINT data_size;
void *data;
@ -1185,12 +1185,6 @@ HRESULT WINAPI D3DXLoadSurfaceFromResourceW(IDirect3DSurface9 *dst_surface,
data, data_size, src_rect, filter, color_key, src_info);
}
if ((hResInfo = FindResourceW(src_module, resource, (const WCHAR *)RT_BITMAP)))
{
FIXME("Implement loading bitmaps from resource type RT_BITMAP.\n");
return E_NOTIMPL;
}
return D3DXERR_INVALIDDATA;
}

View File

@ -380,11 +380,11 @@ static void test_D3DXGetImageInfo(void)
todo_wine {
hr = D3DXGetImageInfoFromResourceA(NULL, MAKEINTRESOURCEA(IDB_BITMAP_1x1), &info); /* RT_BITMAP */
ok(hr == D3D_OK, "D3DXGetImageInfoFromResource returned %#x, expected %#x\n", hr, D3D_OK);
hr = D3DXGetImageInfoFromResourceA(NULL, MAKEINTRESOURCEA(IDB_BITMAP_1x1), NULL);
ok(hr == D3D_OK, "D3DXGetImageInfoFromResource returned %#x, expected %#x\n", hr, D3D_OK);
}
hr = D3DXGetImageInfoFromResourceA(NULL, MAKEINTRESOURCEA(IDB_BITMAP_1x1), NULL);
ok(hr == D3D_OK, "D3DXGetImageInfoFromResource returned %#x, expected %#x\n", hr, D3D_OK);
hr = D3DXGetImageInfoFromResourceA(NULL, MAKEINTRESOURCEA(IDD_BITMAPDATA_1x1), &info); /* RT_RCDATA */
ok(hr == D3D_OK, "D3DXGetImageInfoFromResource returned %#x, expected %#x\n", hr, D3D_OK);

View File

@ -791,7 +791,9 @@ HRESULT WINAPI D3DXCreateTextureFromResourceExA(struct IDirect3DDevice9 *device,
if (!device || !texture)
return D3DERR_INVALIDCALL;
resinfo = FindResourceA(srcmodule, resource, (LPCSTR) RT_RCDATA);
resinfo = FindResourceA(srcmodule, resource, (const char *)RT_RCDATA);
if (!resinfo) /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
resinfo = FindResourceA(srcmodule, resource, (const char *)RT_BITMAP);
if (resinfo)
{
@ -810,15 +812,6 @@ HRESULT WINAPI D3DXCreateTextureFromResourceExA(struct IDirect3DDevice9 *device,
srcinfo, palette, texture);
}
/* Try loading the resource as bitmap data */
resinfo = FindResourceA(srcmodule, resource, (LPCSTR) RT_BITMAP);
if (resinfo)
{
FIXME("Implement loading bitmaps from resource type RT_BITMAP\n");
return E_NOTIMPL;
}
return D3DXERR_INVALIDDATA;
}
@ -834,7 +827,9 @@ HRESULT WINAPI D3DXCreateTextureFromResourceExW(struct IDirect3DDevice9 *device,
if (!device || !texture)
return D3DERR_INVALIDCALL;
resinfo = FindResourceW(srcmodule, resource, (LPCWSTR) RT_RCDATA);
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)
{
@ -853,15 +848,6 @@ HRESULT WINAPI D3DXCreateTextureFromResourceExW(struct IDirect3DDevice9 *device,
srcinfo, palette, texture);
}
/* Try loading the resource as bitmap data */
resinfo = FindResourceW(srcmodule, resource, (LPCWSTR) RT_BITMAP);
if (resinfo)
{
FIXME("Implement loading bitmaps from resource type RT_BITMAP\n");
return E_NOTIMPL;
}
return D3DXERR_INVALIDDATA;
}