https://git.reactos.org/?p=reactos.git;a=commitdiff;h=38d868820ac082cb5176f6...
commit 38d868820ac082cb5176f65c83ddf8a322737a1a Author: winesync ros-dev@reactos.org AuthorDate: Mon Sep 21 23:00:50 2020 +0200 Commit: Jérôme Gardou jerome.gardou@reactos.org CommitDate: Thu Feb 4 16:37:04 2021 +0100
[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 --- dll/directx/wine/d3dx9_36/surface.c | 3 +++ modules/rostests/winetests/d3dx9_36/surface.c | 11 +++++++++++ sdk/tools/winesync/d3dx9.cfg | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/dll/directx/wine/d3dx9_36/surface.c b/dll/directx/wine/d3dx9_36/surface.c index 4786c90bd9b..418d4e613d8 100644 --- a/dll/directx/wine/d3dx9_36/surface.c +++ b/dll/directx/wine/d3dx9_36/surface.c @@ -1915,6 +1915,9 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, if (FAILED(hr = lock_surface(dst_surface, dst_rect, &lockrect, &surface, TRUE))) return hr;
+ src_memory = (BYTE *)src_memory + src_rect->top / srcformatdesc->block_height * src_pitch + + src_rect->left / srcformatdesc->block_width * srcformatdesc->block_byte_count; + if (src_format == surfdesc.Format && dst_size.width == src_size.width && dst_size.height == src_size.height diff --git a/modules/rostests/winetests/d3dx9_36/surface.c b/modules/rostests/winetests/d3dx9_36/surface.c index ba441879597..1a39d82961d 100644 --- a/modules/rostests/winetests/d3dx9_36/surface.c +++ b/modules/rostests/winetests/d3dx9_36/surface.c @@ -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); diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg index 02c8841279b..cd65a0d8660 100644 --- a/sdk/tools/winesync/d3dx9.cfg +++ b/sdk/tools/winesync/d3dx9.cfg @@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h, include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h, include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h} -tags: {wine: a9c158b72aae1efed159d40fde086cdc608bc62e} +tags: {wine: 88d8ae383932ad1c292c74da7dcc19f00d8423f7}