https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4198c58dcae25192cc60fd8551bad6550f6f026c

commit 4198c58dcae25192cc60fd8551bad6550f6f026c
Author:     winesync <[email protected]>
AuthorDate: Mon Sep 21 23:00:51 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Thu Feb 4 16:37:04 2021 +0100

    [WINESYNC] d3dx9: Compute the correct source rect in 
D3DXLoadSurfaceFromFileInMemory().
    
    Signed-off-by: Matteo Bruni <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id f934ef1a14108aa535e76900b29cba0dd8253f80 by Matteo Bruni 
<[email protected]>
---
 dll/directx/wine/d3dx9_36/surface.c           |  2 +-
 modules/rostests/winetests/d3dx9_36/texture.c | 22 ++++++++++++++++++++++
 sdk/tools/winesync/d3dx9.cfg                  |  2 +-
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/dll/directx/wine/d3dx9_36/surface.c 
b/dll/directx/wine/d3dx9_36/surface.c
index 04cdc254f69..df4c5a725bb 100644
--- a/dll/directx/wine/d3dx9_36/surface.c
+++ b/dll/directx/wine/d3dx9_36/surface.c
@@ -1172,7 +1172,7 @@ HRESULT WINAPI 
D3DXLoadSurfaceFromFileInMemory(IDirect3DSurface9 *pDestSurface,
         wicrect.Height = imginfo.Height;
     }
 
-    SetRect(&rect, 0, 0, wicrect.Width, wicrect.Height);
+    SetRect(&rect, wicrect.X, wicrect.Y, wicrect.X + wicrect.Width, wicrect.Y 
+ wicrect.Height);
 
     if (imginfo.ImageFileFormat == D3DXIFF_DDS)
     {
diff --git a/modules/rostests/winetests/d3dx9_36/texture.c 
b/modules/rostests/winetests/d3dx9_36/texture.c
index 6d39bf72b92..229c857ac2e 100644
--- a/modules/rostests/winetests/d3dx9_36/texture.c
+++ b/modules/rostests/winetests/d3dx9_36/texture.c
@@ -1824,6 +1824,28 @@ static void 
test_D3DXCreateTextureFromFileInMemory(IDirect3DDevice9 *device)
     hr = IDirect3DSurface9_UnlockRect(uncompressed_surface);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
 
+    hr = D3DXLoadSurfaceFromFileInMemory(surface, NULL, &rect, dds_dxt5_8_8,
+            sizeof(dds_dxt5_8_8), &rect, D3DX_FILTER_POINT, 0, NULL);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    hr = D3DXLoadSurfaceFromSurface(uncompressed_surface, NULL, NULL, surface, 
NULL, NULL, D3DX_FILTER_NONE, 0);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+
+    hr = IDirect3DSurface9_LockRect(uncompressed_surface, &lock_rect, NULL, 
D3DLOCK_READONLY);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+    for (y = 0; y < 8; ++y)
+    {
+        for (x = 0; x < 8; ++x)
+        {
+            ok(compare_color(((DWORD *)lock_rect.pBits)[lock_rect.Pitch / 4 * 
y + x],
+                    dds_dxt5_8_8_expected_misaligned_3[y * 8 + x], 0),
+                    "Color at position %u, %u is 0x%08x, expected 0x%08x.\n",
+                    x, y, ((DWORD *)lock_rect.pBits)[lock_rect.Pitch / 4 * y + 
x],
+                    dds_dxt5_8_8_expected_misaligned_3[y * 8 + x]);
+        }
+    }
+    hr = IDirect3DSurface9_UnlockRect(uncompressed_surface);
+    ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
+
     IDirect3DSurface9_Release(uncompressed_surface);
     IDirect3DSurface9_Release(surface);
     IDirect3DTexture9_Release(texture);
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index a974d2afe68..baaa7d70120 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: 536fce7f3b887fcc087d4c00106ceb2f0ff93c01}
+tags: {wine: f934ef1a14108aa535e76900b29cba0dd8253f80}

Reply via email to