Ziqing Hui : d3dx10: Implement D3DX10GetImageInfoFromFileA().
Alexandre Julliard
julliard at winehq.org
Wed Sep 30 14:35:30 CDT 2020
Module: wine
Branch: master
Commit: 937b585996b0bf4e65170b447cef60bc6d9408d4
URL: https://source.winehq.org/git/wine.git/?a=commit;h=937b585996b0bf4e65170b447cef60bc6d9408d4
Author: Ziqing Hui <zhui at codeweavers.com>
Date: Wed Sep 30 12:53:48 2020 +0200
d3dx10: Implement D3DX10GetImageInfoFromFileA().
Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3dx10_43/tests/d3dx10.c | 4 +---
dlls/d3dx10_43/texture.c | 24 ++++++++++++++++++++++--
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c
index 02de73865f..897c54249b 100644
--- a/dlls/d3dx10_43/tests/d3dx10.c
+++ b/dlls/d3dx10_43/tests/d3dx10.c
@@ -1395,12 +1395,10 @@ static void test_get_image_info(void)
ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
hr = D3DX10GetImageInfoFromFileW(L"deadbeaf", NULL, &image_info, NULL);
ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#x.\n", hr);
- todo_wine {
hr = D3DX10GetImageInfoFromFileA(NULL, NULL, &image_info, NULL);
ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
hr = D3DX10GetImageInfoFromFileA("deadbeaf", NULL, &image_info, NULL);
ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#x.\n", hr);
- }
for (i = 0; i < ARRAY_SIZE(test_image); ++i)
{
@@ -1413,7 +1411,7 @@ static void test_get_image_info(void)
check_image_info(&image_info, i, __LINE__);
hr = D3DX10GetImageInfoFromFileA(get_str_a(path), NULL, &image_info, NULL);
- todo_wine
+ todo_wine_if(test_image[i].expected.ImageFileFormat == D3DX10_IFF_WMP)
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
if (hr == S_OK)
check_image_info(&image_info, i, __LINE__);
diff --git a/dlls/d3dx10_43/texture.c b/dlls/d3dx10_43/texture.c
index b871345148..23d7b93e64 100644
--- a/dlls/d3dx10_43/texture.c
+++ b/dlls/d3dx10_43/texture.c
@@ -151,9 +151,29 @@ done:
HRESULT WINAPI D3DX10GetImageInfoFromFileA(const char *src_file, ID3DX10ThreadPump *pump, D3DX10_IMAGE_INFO *info,
HRESULT *result)
{
- FIXME("src_file %s, pump %p, info %p, result %p\n", debugstr_a(src_file), pump, info, result);
+ WCHAR *buffer;
+ int str_len;
+ HRESULT hr;
- return E_NOTIMPL;
+ TRACE("src_file %s, pump %p, info %p, result %p.\n", debugstr_a(src_file), pump, info, result);
+
+ if (!src_file || !info)
+ return E_FAIL;
+
+ str_len = MultiByteToWideChar(CP_ACP, 0, src_file, -1, NULL, 0);
+ if (!str_len)
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ buffer = heap_alloc(str_len * sizeof(*buffer));
+ if (!buffer)
+ return E_OUTOFMEMORY;
+
+ MultiByteToWideChar(CP_ACP, 0, src_file, -1, buffer, str_len);
+ hr = D3DX10GetImageInfoFromFileW(buffer, pump, info, result);
+
+ heap_free(buffer);
+
+ return hr;
}
HRESULT WINAPI D3DX10GetImageInfoFromFileW(const WCHAR *src_file, ID3DX10ThreadPump *pump, D3DX10_IMAGE_INFO *info,
More information about the wine-cvs
mailing list