From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/d3dx9_36/surface.c | 10 ++++++++-- dlls/d3dx9_36/tests/surface.c | 9 +++------ 2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index 8bc60ec443f..4413a3c4dec 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -1258,6 +1258,9 @@ HRESULT WINAPI D3DXLoadSurfaceFromFileInMemory(IDirect3DSurface9 *pDestSurface, if (!pDestSurface || !pSrcData || !SrcDataSize) return D3DERR_INVALIDCALL;
+ if (FAILED(hr = d3dx9_handle_load_filter(&dwFilter))) + return hr; + hr = d3dx_image_init(pSrcData, SrcDataSize, &image, 0, 0); if (FAILED(hr)) return D3DXERR_INVALIDDATA; @@ -2205,8 +2208,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, } }
- if (filter == D3DX_DEFAULT) - filter = D3DX_FILTER_TRIANGLE | D3DX_FILTER_DITHER; + if (FAILED(hr = d3dx9_handle_load_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 +2280,9 @@ HRESULT WINAPI D3DXLoadSurfaceFromSurface(IDirect3DSurface9 *dst_surface, if (!dst_surface || !src_surface) return D3DERR_INVALIDCALL;
+ if (FAILED(hr = d3dx9_handle_load_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/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(); }