ddraw: Properly clear the clip list if ddraw_clipper_SetClipList() is called with NULL region data.

This commit is contained in:
Henri Verbeet 2012-01-09 22:16:49 +01:00 committed by Alexandre Julliard
parent e2765579bc
commit 1ef86ad596
5 changed files with 28 additions and 2 deletions

View File

@ -238,10 +238,12 @@ static HRESULT WINAPI ddraw_clipper_SetClipList(IDirectDrawClipper *iface, RGNDA
if (clipper->region)
DeleteObject(clipper->region);
if (!(clipper->region = ExtCreateRegion(NULL, 0, region)))
if (!region)
clipper->region = NULL;
else if (!(clipper->region = ExtCreateRegion(NULL, 0, region)))
{
wined3d_mutex_unlock();
ERR("Failed to create creation.\n");
ERR("Failed to create region.\n");
return E_FAIL;
}

View File

@ -339,6 +339,12 @@ static void test_clipper_blt(void)
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
hr = IDirectDrawClipper_SetClipList(clipper, NULL, 0);
ok(SUCCEEDED(hr), "Failed to set clip list, hr %#x.\n", hr);
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Blt(dst_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface_Release(dst_surface);
IDirectDrawSurface_Release(src_surface);

View File

@ -346,6 +346,12 @@ static void test_clipper_blt(void)
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
hr = IDirectDrawClipper_SetClipList(clipper, NULL, 0);
ok(SUCCEEDED(hr), "Failed to set clip list, hr %#x.\n", hr);
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Blt(dst_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface_Release(dst_surface);
IDirectDrawSurface_Release(src_surface);

View File

@ -641,6 +641,12 @@ static void test_clipper_blt(void)
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
hr = IDirectDrawClipper_SetClipList(clipper, NULL, 0);
ok(SUCCEEDED(hr), "Failed to set clip list, hr %#x.\n", hr);
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_Blt(dst_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface4_Release(dst_surface);
IDirectDrawSurface4_Release(src_surface);

View File

@ -634,6 +634,12 @@ static void test_clipper_blt(void)
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
hr = IDirectDrawClipper_SetClipList(clipper, NULL, 0);
ok(SUCCEEDED(hr), "Failed to set clip list, hr %#x.\n", hr);
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_Blt(dst_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface7_Release(dst_surface);
IDirectDrawSurface7_Release(src_surface);