https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9e1d68edb042b6a59c37bab990ee29f8940c324a

commit 9e1d68edb042b6a59c37bab990ee29f8940c324a
Author:     winesync <[email protected]>
AuthorDate: Sat Jan 4 01:48:04 2020 +0100
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Feb 26 18:19:18 2020 +0100

    [WINESYNC]d3dx9: Do not ignore surface map failure in 
D3DXSaveSurfaceToFileInMemory().
    
    Signed-off-by: Paul Gofman <[email protected]>
    Signed-off-by: Matteo Bruni <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id ce090114340fe6ce9314f543a1389de9bdc6df14 by Paul Gofman 
<[email protected]>
---
 dll/directx/wine/d3dx9_36/surface.c | 22 ++++++++++++----------
 sdk/tools/winesync/d3dx9.cfg        |  2 +-
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/dll/directx/wine/d3dx9_36/surface.c 
b/dll/directx/wine/d3dx9_36/surface.c
index a6eb5482f71..faac1419517 100644
--- a/dll/directx/wine/d3dx9_36/surface.c
+++ b/dll/directx/wine/d3dx9_36/surface.c
@@ -2229,12 +2229,12 @@ HRESULT WINAPI 
D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
         if (src_surface_desc.Format == d3d_pixel_format) /* Simple copy */
         {
             hr = IDirect3DSurface9_LockRect(src_surface, &locked_rect, 
src_rect, D3DLOCK_READONLY);
-            if (SUCCEEDED(hr))
-            {
-                IWICBitmapFrameEncode_WritePixels(frame, height,
-                    locked_rect.Pitch, height * locked_rect.Pitch, 
locked_rect.pBits);
-                IDirect3DSurface9_UnlockRect(src_surface);
-            }
+            if (FAILED(hr))
+                goto cleanup;
+
+            IWICBitmapFrameEncode_WritePixels(frame, height,
+                locked_rect.Pitch, height * locked_rect.Pitch, 
locked_rect.pBits);
+            IDirect3DSurface9_UnlockRect(src_surface);
         }
         else /* Pixel format conversion */
         {
@@ -2266,12 +2266,14 @@ HRESULT WINAPI 
D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
             }
 
             hr = IDirect3DSurface9_LockRect(src_surface, &locked_rect, 
src_rect, D3DLOCK_READONLY);
-            if (SUCCEEDED(hr))
+            if (FAILED(hr))
             {
-                convert_argb_pixels(locked_rect.pBits, locked_rect.Pitch, 0, 
&size, src_format_desc,
-                    dst_data, dst_pitch, 0, &size, dst_format_desc, 0, NULL);
-                IDirect3DSurface9_UnlockRect(src_surface);
+                HeapFree(GetProcessHeap(), 0, dst_data);
+                goto cleanup;
             }
+            convert_argb_pixels(locked_rect.pBits, locked_rect.Pitch, 0, 
&size, src_format_desc,
+                dst_data, dst_pitch, 0, &size, dst_format_desc, 0, NULL);
+            IDirect3DSurface9_UnlockRect(src_surface);
 
             IWICBitmapFrameEncode_WritePixels(frame, height, dst_pitch, 
dst_pitch * height, dst_data);
             HeapFree(GetProcessHeap(), 0, dst_data);
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 8045ddd8fda..dd03a62177b 100644
--- a/sdk/tools/winesync/d3dx9.cfg
+++ b/sdk/tools/winesync/d3dx9.cfg
@@ -33,4 +33,4 @@ files:
   include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h
   include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h
 tags:
-  wine: 61e7e6ec1bf5d13d4cafa883ac74fe987c339740
+  wine: ce090114340fe6ce9314f543a1389de9bdc6df14

Reply via email to