From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/d3dx9_36/surface.c | 12 ++++++++++++ dlls/d3dx9_36/tests/d3dx9_test_images.h | 9 ++++----- dlls/d3dx9_36/tests/surface.c | 9 +++------ dlls/d3dx9_36/tests/texture.c | 6 ++---- 4 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index e3a5b69e41d..b524a2e2716 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -1258,6 +1258,11 @@ HRESULT WINAPI D3DXLoadSurfaceFromFileInMemory(IDirect3DSurface9 *pDestSurface, if (!pDestSurface || !pSrcData || !SrcDataSize) return D3DERR_INVALIDCALL;
+ if (dwFilter == D3DX_DEFAULT) + dwFilter = D3DX_FILTER_TRIANGLE | D3DX_FILTER_DITHER; + if (FAILED(hr = d3dx9_validate_filter(dwFilter))) + return hr; + hr = d3dx_image_init(pSrcData, SrcDataSize, &image, 0, 0); if (FAILED(hr)) return D3DXERR_INVALIDDATA; @@ -2207,6 +2212,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
if (filter == D3DX_DEFAULT) filter = D3DX_FILTER_TRIANGLE | D3DX_FILTER_DITHER; + if (FAILED(hr = d3dx9_validate_filter(filter))) + return hr;
hr = d3dx_pixels_init(src_memory, src_pitch, 0, src_palette, srcformatdesc->format, src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1, &src_pixels); @@ -2277,6 +2284,11 @@ HRESULT WINAPI D3DXLoadSurfaceFromSurface(IDirect3DSurface9 *dst_surface, if (!dst_surface || !src_surface) return D3DERR_INVALIDCALL;
+ if (filter == D3DX_DEFAULT) + filter = D3DX_FILTER_TRIANGLE | D3DX_FILTER_DITHER; + if (FAILED(hr = d3dx9_validate_filter(filter))) + return hr; + IDirect3DSurface9_GetDesc(src_surface, &src_desc); src_format_desc = get_format_info(src_desc.Format); if (!src_rect) diff --git a/dlls/d3dx9_36/tests/d3dx9_test_images.h b/dlls/d3dx9_36/tests/d3dx9_test_images.h index 8dabd8c2f84..256897d37b9 100644 --- a/dlls/d3dx9_36/tests/d3dx9_test_images.h +++ b/dlls/d3dx9_36/tests/d3dx9_test_images.h @@ -27,7 +27,6 @@ static const struct { uint32_t filter; HRESULT expected_hr; - BOOL d3dx_filter_texture_todo; } test_filter_values[] = { @@ -36,16 +35,16 @@ test_filter_values[] = { 0x007f0001, D3D_OK }, { D3DX_DEFAULT_NONPOW2, D3DERR_INVALIDCALL }, { D3DX_FROM_FILE, D3DERR_INVALIDCALL }, - { 0, D3DERR_INVALIDCALL, .d3dx_filter_texture_todo = TRUE }, + { 0, D3DERR_INVALIDCALL }, { D3DX_FILTER_BOX + 1, D3DERR_INVALIDCALL }, { 0x0000ffff, D3DERR_INVALIDCALL }, - { 0x7c000001, D3DERR_INVALIDCALL, .d3dx_filter_texture_todo = TRUE }, - { 0x80000001, D3DERR_INVALIDCALL, .d3dx_filter_texture_todo = TRUE }, + { 0x7c000001, D3DERR_INVALIDCALL }, + { 0x80000001, D3DERR_INVALIDCALL }, /* * Mip skip bits are 30-26, 25-23 are unused, but setting them results in * failure. */ - { 0x03800001, D3DERR_INVALIDCALL, .d3dx_filter_texture_todo = TRUE }, + { 0x03800001, D3DERR_INVALIDCALL }, };
/* 1x1 bmp (1 bpp) */ diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c index c29f61a8e7d..e2ea26cbd0c 100644 --- a/dlls/d3dx9_36/tests/surface.c +++ b/dlls/d3dx9_36/tests/surface.c @@ -1059,8 +1059,7 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device) winetest_push_context("Filter %d (%#x)", i, test_filter_values[i].filter);
hr = D3DXLoadSurfaceFromSurface(surf, NULL, NULL, newsurf, NULL, NULL, test_filter_values[i].filter, 0); - todo_wine_if(FAILED(test_filter_values[i].expected_hr)) ok(hr == test_filter_values[i].expected_hr, - "Unexpected hr %#lx.\n", hr); + ok(hr == test_filter_values[i].expected_hr, "Unexpected hr %#lx.\n", hr);
winetest_pop_context(); } @@ -1232,13 +1231,11 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
hr = D3DXLoadSurfaceFromFileInMemory(surf, NULL, NULL, dds_24bit, sizeof(dds_24bit), NULL, test_filter_values[i].filter, 0, NULL); - todo_wine_if(FAILED(test_filter_values[i].expected_hr)) ok(hr == test_filter_values[i].expected_hr, - "Unexpected hr %#lx.\n", hr); + ok(hr == test_filter_values[i].expected_hr, "Unexpected hr %#lx.\n", hr);
hr = D3DXLoadSurfaceFromMemory(surf, NULL, NULL, pixdata_a8b8g8r8, D3DFMT_A8B8G8R8, 8, NULL, &rect, test_filter_values[i].filter, 0); - todo_wine_if(FAILED(test_filter_values[i].expected_hr)) ok(hr == test_filter_values[i].expected_hr, - "Unexpected hr %#lx.\n", hr); + ok(hr == test_filter_values[i].expected_hr, "Unexpected hr %#lx.\n", hr);
winetest_pop_context(); } diff --git a/dlls/d3dx9_36/tests/texture.c b/dlls/d3dx9_36/tests/texture.c index 0c02a9e7c65..35303faf625 100644 --- a/dlls/d3dx9_36/tests/texture.c +++ b/dlls/d3dx9_36/tests/texture.c @@ -1064,8 +1064,7 @@ static void test_D3DXFilterTexture(IDirect3DDevice9 *device) winetest_push_context("Filter %d (%#x)", i, test_filter_values[i].filter);
hr = D3DXFilterTexture((IDirect3DBaseTexture9 *)tex, NULL, 0, test_filter_values[i].filter); - todo_wine_if(test_filter_values[i].d3dx_filter_texture_todo) ok(hr == test_filter_values[i].expected_hr, - "Unexpected hr %#lx.\n", hr); + ok(hr == test_filter_values[i].expected_hr, "Unexpected hr %#lx.\n", hr);
winetest_pop_context(); } @@ -1143,8 +1142,7 @@ static void test_D3DXFilterTexture(IDirect3DDevice9 *device) winetest_push_context("Filter %d (%#x)", i, test_filter_values[i].filter);
hr = D3DXFilterTexture((IDirect3DBaseTexture9 *)cubetex, NULL, 0, test_filter_values[i].filter); - todo_wine_if(test_filter_values[i].d3dx_filter_texture_todo) ok(hr == test_filter_values[i].expected_hr, - "Unexpected hr %#lx.\n", hr); + ok(hr == test_filter_values[i].expected_hr, "Unexpected hr %#lx.\n", hr);
winetest_pop_context(); }