[WINESYNC] d3dx9: Handle non-zero source rect position in D3DXLoadSurfaceFromMemory().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=41936
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 88d8ae383932ad1c292c74da7dcc19f00d8423f7 by Matteo Bruni <mbruni@codeweavers.com>
This commit is contained in:
winesync 2020-09-21 23:00:50 +02:00 committed by Jérôme Gardou
parent 8c85a63a2b
commit 38d868820a
3 changed files with 15 additions and 1 deletions

View file

@ -942,8 +942,19 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device)
check_release((IUnknown*)surf, 0);
SetRect(&rect, 1, 1, 2, 2);
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 1, 1, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &surf, NULL);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = D3DXLoadSurfaceFromMemory(surf, NULL, NULL, pixdata_a8b8g8r8,
D3DFMT_A8R8G8B8, 8, NULL, &rect, D3DX_FILTER_NONE, 0);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
IDirect3DSurface9_LockRect(surf, &lockrect, NULL, D3DLOCK_READONLY);
check_pixel_4bpp(&lockrect, 0, 0, 0x8dc32bf6);
IDirect3DSurface9_UnlockRect(surf);
check_release((IUnknown *)surf, 0);
/* test color conversion */
SetRect(&rect, 0, 0, 2, 2);
/* A8R8G8B8 */
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 2, 2, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &surf, NULL);
if(FAILED(hr)) skip("Failed to create a surface (%#x)\n", hr);