--- dlls/d3dx9_36/surface.c | 52 +++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 48 insertions(+), 4 deletions(-) diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index 77cad08..ad65ef4 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -249,8 +249,30 @@ HRESULT WINAPI D3DXGetImageInfoFromResourceA(HMODULE module, LPCSTR resource, D3 resinfo = FindResourceA(module, resource, (LPCSTR)RT_BITMAP); if(resinfo) { - FIXME("Implement loading bitmaps from resource type RT_BITMAP\n"); - return E_NOTIMPL; + HBITMAP bitmap; + SIZE size; + + if(!module) bitmap = LoadBitmapA(GetModuleHandleA(NULL), resource); + else bitmap = LoadBitmapA(module, resource); + + if(!bitmap) return D3DXERR_INVALIDDATA; + + if(!GetBitmapDimensionEx(bitmap, &size)) + return D3DXERR_INVALIDDATA; + + if(!info) return D3D_OK; + + info->Width = size.cx; + info->Height = size.cy; + info->Depth = 1; + info->MipLevels = 1; + info->Format = D3DFMT_R8G8B8; + info->ResourceType = D3DRTYPE_TEXTURE; + info->ImageFileFormat = D3DXIFF_BMP; + + FIXME("Implement proper format recognition."); + + return D3D_OK; } return D3DXERR_INVALIDDATA; } @@ -274,8 +296,30 @@ HRESULT WINAPI D3DXGetImageInfoFromResourceW(HMODULE module, LPCWSTR resource, D resinfo = FindResourceW(module, resource, (LPCWSTR)RT_BITMAP); if(resinfo) { - FIXME("Implement loading bitmaps from resource type RT_BITMAP\n"); - return E_NOTIMPL; + HBITMAP bitmap; + SIZE size; + + if(!module) bitmap = LoadBitmapW(GetModuleHandleA(NULL), resource); + else bitmap = LoadBitmapW(module, resource); + + if(!bitmap) return D3DXERR_INVALIDDATA; + + if(!GetBitmapDimensionEx(bitmap, &size)) + return D3DXERR_INVALIDDATA; + + if(!info) return D3D_OK; + + info->Width = size.cx; + info->Height = size.cy; + info->Depth = 1; + info->MipLevels = 1; + info->Format = D3DFMT_R8G8B8; + info->ResourceType = D3DRTYPE_TEXTURE; + info->ImageFileFormat = D3DXIFF_BMP; + + FIXME("Implement proper format recognition."); + + return D3D_OK; } return D3DXERR_INVALIDDATA; } -- 1.7.3.4