d3dx9_36: Add DIB file support to D3DXLoadSurfaceFromFileInMemory.

This commit is contained in:
Christian Costa 2013-04-22 23:08:09 +02:00 committed by Alexandre Julliard
parent 4653b839e7
commit 792e2ee248
3 changed files with 12 additions and 9 deletions

View File

@ -1073,6 +1073,9 @@ HRESULT WINAPI D3DXLoadSurfaceFromFileInMemory(IDirect3DSurface9 *pDestSurface,
return hr;
}
if (imginfo.ImageFileFormat == D3DXIFF_DIB)
convert_dib_to_bmp((void**)&pSrcData, &SrcDataSize);
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
if (FAILED(CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, (void**)&factory)))
@ -1135,6 +1138,9 @@ cleanup_bmp:
cleanup_err:
CoUninitialize();
if (imginfo.ImageFileFormat == D3DXIFF_DIB)
HeapFree(GetProcessHeap(), 0, (void*)pSrcData);
if (FAILED(hr))
return D3DXERR_INVALIDDATA;

View File

@ -623,10 +623,8 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
/* D3DXLoadSurfaceFromResource */
todo_wine {
hr = D3DXLoadSurfaceFromResourceA(surf, NULL, NULL, NULL, MAKEINTRESOURCE(IDB_BITMAP_1x1), NULL, D3DX_DEFAULT, 0, NULL);
ok(hr == D3D_OK, "D3DXLoadSurfaceFromResource returned %#x, expected %#x\n", hr, D3D_OK);
}
hr = D3DXLoadSurfaceFromResourceA(surf, NULL, NULL, NULL, MAKEINTRESOURCE(IDB_BITMAP_1x1), NULL, D3DX_DEFAULT, 0, NULL);
ok(hr == D3D_OK, "D3DXLoadSurfaceFromResource returned %#x, expected %#x\n", hr, D3D_OK);
hr = D3DXLoadSurfaceFromResourceA(surf, NULL, NULL, NULL, MAKEINTRESOURCE(IDD_BITMAPDATA_1x1), NULL, D3DX_DEFAULT, 0, NULL);
ok(hr == D3D_OK, "D3DXLoadSurfaceFromResource returned %#x, expected %#x\n", hr, D3D_OK);

View File

@ -728,11 +728,10 @@ static void test_D3DXCreateTexture(IDirect3DDevice9 *device)
}
/* D3DXCreateTextureFromResource */
todo_wine {
hr = D3DXCreateTextureFromResourceA(device, NULL, MAKEINTRESOURCEA(IDB_BITMAP_1x1), &texture);
ok(hr == D3D_OK, "D3DXCreateTextureFromResource returned %#x, expected %#x\n", hr, D3D_OK);
if (SUCCEEDED(hr)) IDirect3DTexture9_Release(texture);
}
hr = D3DXCreateTextureFromResourceA(device, NULL, MAKEINTRESOURCEA(IDB_BITMAP_1x1), &texture);
ok(hr == D3D_OK, "D3DXCreateTextureFromResource returned %#x, expected %#x\n", hr, D3D_OK);
if (SUCCEEDED(hr)) IDirect3DTexture9_Release(texture);
hr = D3DXCreateTextureFromResourceA(device, NULL, MAKEINTRESOURCEA(IDD_BITMAPDATA_1x1), &texture);
ok(hr == D3D_OK, "D3DXCreateTextureFromResource returned %#x, expected %#x\n", hr, D3D_OK);
if (SUCCEEDED(hr)) IDirect3DTexture9_Release(texture);