Commit eeefed3d authored by Lasse Rasinen's avatar Lasse Rasinen Committed by Alexandre Julliard

d3d9: Update locked_rect only if wined3d_surface_map succeeds.

parent c25c0198
...@@ -293,8 +293,11 @@ static HRESULT WINAPI d3d9_surface_LockRect(IDirect3DSurface9 *iface, ...@@ -293,8 +293,11 @@ static HRESULT WINAPI d3d9_surface_LockRect(IDirect3DSurface9 *iface,
hr = wined3d_surface_map(surface->wined3d_surface, &map_desc, rect, flags); hr = wined3d_surface_map(surface->wined3d_surface, &map_desc, rect, flags);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
locked_rect->Pitch = map_desc.row_pitch; if (SUCCEEDED(hr))
locked_rect->pBits = map_desc.data; {
locked_rect->Pitch = map_desc.row_pitch;
locked_rect->pBits = map_desc.data;
}
return hr; return hr;
} }
......
...@@ -5402,8 +5402,13 @@ static void test_lockrect_invalid(void) ...@@ -5402,8 +5402,13 @@ static void test_lockrect_invalid(void)
hr = IDirect3DSurface9_LockRect(surface, &locked_rect, NULL, 0); hr = IDirect3DSurface9_LockRect(surface, &locked_rect, NULL, 0);
ok(SUCCEEDED(hr), "Failed to lock surface with rect NULL, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to lock surface with rect NULL, hr %#x.\n", hr);
locked_rect.pBits = (BYTE *)0xdeadbeef;
locked_rect.Pitch = 1;
hr = IDirect3DSurface9_LockRect(surface, &locked_rect, NULL, 0); hr = IDirect3DSurface9_LockRect(surface, &locked_rect, NULL, 0);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
ok(locked_rect.pBits == (BYTE *)0xdeadbeef, "Got unexpected pBits: %p\n",
locked_rect.pBits);
ok(locked_rect.Pitch == 1, "Got unexpected pitch %d\n", locked_rect.Pitch);
hr = IDirect3DSurface9_UnlockRect(surface); hr = IDirect3DSurface9_UnlockRect(surface);
ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment