mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
ddraw: DDSD_LPSURFACE requires a non-NULL lpSurface.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
43c43179cd
commit
6c9e1a4735
5 changed files with 36 additions and 5 deletions
|
@ -5970,7 +5970,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
|
||||
/* If the surface is of the 'ALLOCONLOAD' type, ignore the LPSURFACE
|
||||
* field. Frank Herbert's Dune specifies a NULL pointer for lpSurface. */
|
||||
if ((desc->ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD) || !desc->lpSurface)
|
||||
if (desc->ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD)
|
||||
desc->dwFlags &= ~DDSD_LPSURFACE;
|
||||
if (desc->dwFlags & DDSD_LPSURFACE)
|
||||
{
|
||||
|
@ -5988,6 +5988,13 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
if (!desc->lpSurface)
|
||||
{
|
||||
WARN("NULL surface memory pointer specified.\n");
|
||||
HeapFree(GetProcessHeap(), 0, texture);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
if (format_is_compressed(&desc->u4.ddpfPixelFormat))
|
||||
{
|
||||
if (version != 4 && (desc->dwFlags & DDSD_PITCH))
|
||||
|
|
|
@ -4937,7 +4937,6 @@ static void test_create_surface_pitch(void)
|
|||
surface_desc.dwWidth = 63;
|
||||
surface_desc.dwHeight = 63;
|
||||
U1(surface_desc).lPitch = test_data[i].pitch_in;
|
||||
surface_desc.lpSurface = mem;
|
||||
surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat);
|
||||
surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||
U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 32;
|
||||
|
@ -4945,6 +4944,13 @@ static void test_create_surface_pitch(void)
|
|||
U3(surface_desc.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
|
||||
U4(surface_desc.ddpfPixelFormat).dwBBitMask = 0x000000ff;
|
||||
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
if (test_data[i].flags_in & DDSD_LPSURFACE)
|
||||
{
|
||||
HRESULT expected_hr = SUCCEEDED(test_data[i].hr) ? DDERR_INVALIDPARAMS : test_data[i].hr;
|
||||
ok(hr == expected_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, expected_hr);
|
||||
surface_desc.lpSurface = mem;
|
||||
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
}
|
||||
ok(hr == test_data[i].hr || (test_data[i].placement == DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW),
|
||||
"Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
|
||||
if (FAILED(hr))
|
||||
|
|
|
@ -5979,7 +5979,6 @@ static void test_create_surface_pitch(void)
|
|||
surface_desc.dwWidth = 63;
|
||||
surface_desc.dwHeight = 63;
|
||||
U1(surface_desc).lPitch = test_data[i].pitch_in;
|
||||
surface_desc.lpSurface = mem;
|
||||
surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat);
|
||||
surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||
U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 32;
|
||||
|
@ -5987,6 +5986,13 @@ static void test_create_surface_pitch(void)
|
|||
U3(surface_desc.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
|
||||
U4(surface_desc.ddpfPixelFormat).dwBBitMask = 0x000000ff;
|
||||
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
if (test_data[i].flags_in & DDSD_LPSURFACE)
|
||||
{
|
||||
HRESULT expected_hr = SUCCEEDED(test_data[i].hr) ? DDERR_INVALIDPARAMS : test_data[i].hr;
|
||||
ok(hr == expected_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, expected_hr);
|
||||
surface_desc.lpSurface = mem;
|
||||
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
}
|
||||
ok(hr == test_data[i].hr || (test_data[i].placement == DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW),
|
||||
"Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
|
||||
if (FAILED(hr))
|
||||
|
|
|
@ -7512,7 +7512,6 @@ static void test_create_surface_pitch(void)
|
|||
surface_desc.dwWidth = 63;
|
||||
surface_desc.dwHeight = 63;
|
||||
U1(surface_desc).lPitch = test_data[i].pitch_in;
|
||||
surface_desc.lpSurface = mem;
|
||||
U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
|
||||
U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||
U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
|
||||
|
@ -7520,6 +7519,13 @@ static void test_create_surface_pitch(void)
|
|||
U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
|
||||
U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
|
||||
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
if (test_data[i].flags_in & DDSD_LPSURFACE)
|
||||
{
|
||||
HRESULT expected_hr = SUCCEEDED(test_data[i].hr) ? DDERR_INVALIDPARAMS : test_data[i].hr;
|
||||
ok(hr == expected_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, expected_hr);
|
||||
surface_desc.lpSurface = mem;
|
||||
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
}
|
||||
ok(hr == test_data[i].hr || (test_data[i].placement == DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW),
|
||||
"Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
|
||||
if (FAILED(hr))
|
||||
|
|
|
@ -7361,7 +7361,6 @@ static void test_create_surface_pitch(void)
|
|||
surface_desc.dwWidth = 63;
|
||||
surface_desc.dwHeight = 63;
|
||||
U1(surface_desc).lPitch = test_data[i].pitch_in;
|
||||
surface_desc.lpSurface = mem;
|
||||
U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
|
||||
U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||
U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
|
||||
|
@ -7369,6 +7368,13 @@ static void test_create_surface_pitch(void)
|
|||
U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
|
||||
U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
|
||||
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
if (test_data[i].flags_in & DDSD_LPSURFACE)
|
||||
{
|
||||
HRESULT expected_hr = SUCCEEDED(test_data[i].hr) ? DDERR_INVALIDPARAMS : test_data[i].hr;
|
||||
ok(hr == expected_hr, "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, expected_hr);
|
||||
surface_desc.lpSurface = mem;
|
||||
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||
}
|
||||
ok(hr == test_data[i].hr || (test_data[i].placement == DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW),
|
||||
"Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr);
|
||||
if (FAILED(hr))
|
||||
|
|
Loading…
Reference in a new issue