Commit 1ef86ad5 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

parent e2765579
......@@ -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;
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
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