https://git.reactos.org/?p=reactos.git;a=commitdiff;h=083cd9a957f9740cc4e86…
commit 083cd9a957f9740cc4e861201fa135510c2d568d
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Jan 4 01:48:04 2020 +0100
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Wed Feb 26 18:19:18 2020 +0100
[WINESYNC]d3dx9: Use {lock|unlock}_surface() in D3DXLoadSurfaceFromMemory().
Signed-off-by: Paul Gofman <gofmanp(a)gmail.com>
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 65956ae50a136fe8467a0332c7495f36617a16dc by Paul Gofman
<gofmanp(a)gmail.com>
---
dll/directx/wine/d3dx9_36/surface.c | 48 +++++++------------------------------
sdk/tools/winesync/d3dx9.cfg | 2 +-
2 files changed, 9 insertions(+), 41 deletions(-)
diff --git a/dll/directx/wine/d3dx9_36/surface.c b/dll/directx/wine/d3dx9_36/surface.c
index 23e8f7691f2..cae80a8689b 100644
--- a/dll/directx/wine/d3dx9_36/surface.c
+++ b/dll/directx/wine/d3dx9_36/surface.c
@@ -1822,8 +1822,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9
*dst_surface,
DWORD filter, D3DCOLOR color_key)
{
const struct pixel_format_desc *srcformatdesc, *destformatdesc;
- IDirect3DSurface9 *surface = dst_surface;
- IDirect3DDevice9 *device;
+ IDirect3DSurface9 *surface;
D3DSURFACE_DESC surfdesc;
D3DLOCKED_RECT lockrect;
struct volume src_size, dst_size;
@@ -1883,25 +1882,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9
*dst_surface,
return E_NOTIMPL;
}
- if (surfdesc.Pool == D3DPOOL_DEFAULT && !(surfdesc.Usage &
D3DUSAGE_DYNAMIC))
- {
- IDirect3DSurface9_GetDevice(dst_surface, &device);
- hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, surfdesc.Width,
- surfdesc.Height, surfdesc.Format, D3DPOOL_SYSTEMMEM, &surface,
NULL);
- IDirect3DDevice9_Release(device);
- if (FAILED(hr))
- {
- WARN("Failed to create staging surface, hr %#x.\n", hr);
- return D3DERR_INVALIDCALL;
- }
- }
-
- if (FAILED(IDirect3DSurface9_LockRect(surface, &lockrect, dst_rect, 0)))
- {
- if (surface != dst_surface)
- IDirect3DSurface9_Release(surface);
- return D3DXERR_INVALIDDATA;
- }
+ if (FAILED(hr = lock_surface(dst_surface, &lockrect, &surface, TRUE)))
+ return hr;
if (src_format == surfdesc.Format
&& dst_size.width == src_size.width
@@ -1916,8 +1898,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9
*dst_surface,
&& src_size.height != surfdesc.Height))
{
WARN("Source rect %s is misaligned.\n",
wine_dbgstr_rect(src_rect));
- hr = D3DXERR_INVALIDDATA;
- goto done;
+ unlock_surface(dst_surface, &lockrect, surface, FALSE);
+ return D3DXERR_INVALIDDATA;
}
copy_pixels(src_memory, src_pitch, 0, lockrect.pBits, lockrect.Pitch, 0,
@@ -1929,8 +1911,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9
*dst_surface,
|| !is_conversion_to_supported(destformatdesc))
{
FIXME("Unsupported format conversion %#x -> %#x.\n", src_format,
surfdesc.Format);
- hr = E_NOTIMPL;
- goto done;
+ unlock_surface(dst_surface, &lockrect, surface, FALSE);
+ return E_NOTIMPL;
}
if ((filter & 0xf) == D3DX_FILTER_NONE)
@@ -1950,21 +1932,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9
*dst_surface,
}
}
- hr = D3D_OK;
-done:
- IDirect3DSurface9_UnlockRect(surface);
- if (surface != dst_surface)
- {
- if (SUCCEEDED(hr))
- {
- IDirect3DSurface9_GetDevice(dst_surface, &device);
- hr = IDirect3DDevice9_UpdateSurface(device, surface, NULL, dst_surface,
NULL);
- IDirect3DDevice9_Release(device);
- }
- IDirect3DSurface9_Release(surface);
- }
-
- return hr;
+ return unlock_surface(dst_surface, &lockrect, surface, TRUE);
}
/************************************************************
diff --git a/sdk/tools/winesync/d3dx9.cfg b/sdk/tools/winesync/d3dx9.cfg
index 746b3659388..5c969fbf05a 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: 092c14b9d86ee1e96e465908cc524ec85988d0ff
+ wine: 65956ae50a136fe8467a0332c7495f36617a16dc