ddraw: Implement IDirectDrawClipper::SetClipList().
This commit is contained in:
parent
3e9fe3e938
commit
f17e714857
|
@ -69,7 +69,11 @@ static ULONG WINAPI ddraw_clipper_Release(IDirectDrawClipper *iface)
|
|||
TRACE("%p decreasing refcount to %u.\n", clipper, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
if (clipper->region)
|
||||
DeleteObject(clipper->region);
|
||||
HeapFree(GetProcessHeap(), 0, clipper);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
@ -141,7 +145,6 @@ static HRESULT WINAPI ddraw_clipper_GetClipList(IDirectDrawClipper *iface, RECT
|
|||
RGNDATA *clip_list, DWORD *clip_list_size)
|
||||
{
|
||||
struct ddraw_clipper *clipper = impl_from_IDirectDrawClipper(iface);
|
||||
static unsigned int once;
|
||||
HRGN region;
|
||||
|
||||
TRACE("iface %p, rect %s, clip_list %p, clip_list_size %p.\n",
|
||||
|
@ -157,47 +160,49 @@ static HRESULT WINAPI ddraw_clipper_GetClipList(IDirectDrawClipper *iface, RECT
|
|||
ERR("Failed to get window region.\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (rect)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(region = clipper->region))
|
||||
{
|
||||
HRGN clip_region;
|
||||
int ret;
|
||||
|
||||
if (!(clip_region = CreateRectRgnIndirect(rect)))
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
ERR("Failed to create region.\n");
|
||||
DeleteObject(region);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
ret = CombineRgn(region, region, clip_region, RGN_AND);
|
||||
DeleteObject(clip_region);
|
||||
if (ret == ERROR)
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
ERR("Failed to combine regions.\n");
|
||||
DeleteObject(region);
|
||||
return E_FAIL;
|
||||
}
|
||||
wined3d_mutex_unlock();
|
||||
WARN("No clip list set.\n");
|
||||
return DDERR_NOCLIPLIST;
|
||||
}
|
||||
|
||||
*clip_list_size = GetRegionData(region, *clip_list_size, clip_list);
|
||||
DeleteObject(region);
|
||||
|
||||
wined3d_mutex_unlock();
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
if (!once++)
|
||||
FIXME("clipper %p, rect %s, clip_list %p, clip_list_size %p stub!\n",
|
||||
clipper, wine_dbgstr_rect(rect), clip_list, clip_list_size);
|
||||
if (rect)
|
||||
{
|
||||
HRGN clip_region;
|
||||
|
||||
if (clip_list_size)
|
||||
*clip_list_size = 0;
|
||||
if (!(clip_region = CreateRectRgnIndirect(rect)))
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
ERR("Failed to create region.\n");
|
||||
if (clipper->window)
|
||||
DeleteObject(region);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (CombineRgn(clip_region, region, clip_region, RGN_AND) == ERROR)
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
ERR("Failed to combine regions.\n");
|
||||
DeleteObject(clip_region);
|
||||
if (clipper->window)
|
||||
DeleteObject(region);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
region = clip_region;
|
||||
}
|
||||
|
||||
*clip_list_size = GetRegionData(region, *clip_list_size, clip_list);
|
||||
if (rect || clipper->window)
|
||||
DeleteObject(region);
|
||||
|
||||
wined3d_mutex_unlock();
|
||||
return DDERR_NOCLIPLIST;
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -218,10 +223,26 @@ static HRESULT WINAPI ddraw_clipper_SetClipList(IDirectDrawClipper *iface, RGNDA
|
|||
{
|
||||
struct ddraw_clipper *clipper = impl_from_IDirectDrawClipper(iface);
|
||||
|
||||
FIXME("iface %p, region %p, flags %#x stub!\n", iface, region, flags);
|
||||
TRACE("iface %p, region %p, flags %#x.\n", iface, region, flags);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
|
||||
if (clipper->window)
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
return DDERR_CLIPPERISUSINGHWND;
|
||||
}
|
||||
|
||||
if (clipper->region)
|
||||
DeleteObject(clipper->region);
|
||||
if (!(clipper->region = ExtCreateRegion(NULL, 0, region)))
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
ERR("Failed to create creation.\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
|
|
@ -361,6 +361,7 @@ struct ddraw_clipper
|
|||
IDirectDrawClipper IDirectDrawClipper_iface;
|
||||
LONG ref;
|
||||
HWND window;
|
||||
HRGN region;
|
||||
BOOL initialized;
|
||||
};
|
||||
|
||||
|
|
|
@ -210,6 +210,8 @@ static void test_clipper_blt(void)
|
|||
|
||||
hr = IDirectDraw_CreateClipper(ddraw, 0, &clipper, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create clipper, hr %#x.\n", hr);
|
||||
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
|
||||
ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirectDrawClipper_SetHWnd(clipper, 0, window);
|
||||
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
|
||||
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
|
||||
|
@ -314,7 +316,7 @@ static void test_clipper_blt(void)
|
|||
|
||||
U5(fx).dwFillColor = 0xff0000ff;
|
||||
hr = IDirectDrawSurface_Blt(dst_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
|
||||
todo_wine ok(SUCCEEDED(hr), "Failed to clear destination surface, hr %#x.\n", hr);
|
||||
ok(SUCCEEDED(hr), "Failed to clear destination surface, hr %#x.\n", hr);
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
for (j = 0; j < 4; ++j)
|
||||
|
@ -322,12 +324,8 @@ static void test_clipper_blt(void)
|
|||
x = 80 * ((2 * j) + 1);
|
||||
y = 60 * ((2 * i) + 1);
|
||||
color = get_surface_color(dst_surface, x, y);
|
||||
if ((i < 2 && j < 2) || (i >= 2 && j >= 2))
|
||||
todo_wine ok(compare_color(color, expected2[i * 4 + j], 1),
|
||||
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected2[i * 4 + j], x, y, color);
|
||||
else
|
||||
ok(compare_color(color, expected2[i * 4 + j], 1),
|
||||
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected2[i * 4 + j], x, y, color);
|
||||
ok(compare_color(color, expected2[i * 4 + j], 1),
|
||||
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected2[i * 4 + j], x, y, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -217,6 +217,8 @@ static void test_clipper_blt(void)
|
|||
|
||||
hr = IDirectDraw2_CreateClipper(ddraw, 0, &clipper, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create clipper, hr %#x.\n", hr);
|
||||
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
|
||||
ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirectDrawClipper_SetHWnd(clipper, 0, window);
|
||||
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
|
||||
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
|
||||
|
@ -321,7 +323,7 @@ static void test_clipper_blt(void)
|
|||
|
||||
U5(fx).dwFillColor = 0xff0000ff;
|
||||
hr = IDirectDrawSurface_Blt(dst_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
|
||||
todo_wine ok(SUCCEEDED(hr), "Failed to clear destination surface, hr %#x.\n", hr);
|
||||
ok(SUCCEEDED(hr), "Failed to clear destination surface, hr %#x.\n", hr);
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
for (j = 0; j < 4; ++j)
|
||||
|
@ -329,12 +331,8 @@ static void test_clipper_blt(void)
|
|||
x = 80 * ((2 * j) + 1);
|
||||
y = 60 * ((2 * i) + 1);
|
||||
color = get_surface_color(dst_surface, x, y);
|
||||
if ((i < 2 && j < 2) || (i >= 2 && j >= 2))
|
||||
todo_wine ok(compare_color(color, expected2[i * 4 + j], 1),
|
||||
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected2[i * 4 + j], x, y, color);
|
||||
else
|
||||
ok(compare_color(color, expected2[i * 4 + j], 1),
|
||||
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected2[i * 4 + j], x, y, color);
|
||||
ok(compare_color(color, expected2[i * 4 + j], 1),
|
||||
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected2[i * 4 + j], x, y, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -513,6 +513,8 @@ static void test_clipper_blt(void)
|
|||
|
||||
hr = IDirectDraw4_CreateClipper(ddraw, 0, &clipper, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create clipper, hr %#x.\n", hr);
|
||||
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
|
||||
ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirectDrawClipper_SetHWnd(clipper, 0, window);
|
||||
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
|
||||
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
|
||||
|
@ -616,7 +618,7 @@ static void test_clipper_blt(void)
|
|||
|
||||
U5(fx).dwFillColor = 0xff0000ff;
|
||||
hr = IDirectDrawSurface4_Blt(dst_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
|
||||
todo_wine ok(SUCCEEDED(hr), "Failed to clear destination surface, hr %#x.\n", hr);
|
||||
ok(SUCCEEDED(hr), "Failed to clear destination surface, hr %#x.\n", hr);
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
for (j = 0; j < 4; ++j)
|
||||
|
@ -624,12 +626,8 @@ static void test_clipper_blt(void)
|
|||
x = 80 * ((2 * j) + 1);
|
||||
y = 60 * ((2 * i) + 1);
|
||||
color = get_surface_color(dst_surface, x, y);
|
||||
if ((i < 2 && j < 2) || (i >= 2 && j >= 2))
|
||||
todo_wine ok(compare_color(color, expected2[i * 4 + j], 1),
|
||||
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected2[i * 4 + j], x, y, color);
|
||||
else
|
||||
ok(compare_color(color, expected2[i * 4 + j], 1),
|
||||
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected2[i * 4 + j], x, y, color);
|
||||
ok(compare_color(color, expected2[i * 4 + j], 1),
|
||||
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected2[i * 4 + j], x, y, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -506,6 +506,8 @@ static void test_clipper_blt(void)
|
|||
|
||||
hr = IDirectDraw7_CreateClipper(ddraw, 0, &clipper, NULL);
|
||||
ok(SUCCEEDED(hr), "Failed to create clipper, hr %#x.\n", hr);
|
||||
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
|
||||
ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirectDrawClipper_SetHWnd(clipper, 0, window);
|
||||
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
|
||||
hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
|
||||
|
@ -609,7 +611,7 @@ static void test_clipper_blt(void)
|
|||
|
||||
U5(fx).dwFillColor = 0xff0000ff;
|
||||
hr = IDirectDrawSurface7_Blt(dst_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
|
||||
todo_wine ok(SUCCEEDED(hr), "Failed to clear destination surface, hr %#x.\n", hr);
|
||||
ok(SUCCEEDED(hr), "Failed to clear destination surface, hr %#x.\n", hr);
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
for (j = 0; j < 4; ++j)
|
||||
|
@ -617,12 +619,8 @@ static void test_clipper_blt(void)
|
|||
x = 80 * ((2 * j) + 1);
|
||||
y = 60 * ((2 * i) + 1);
|
||||
color = get_surface_color(dst_surface, x, y);
|
||||
if ((i < 2 && j < 2) || (i >= 2 && j >= 2))
|
||||
todo_wine ok(compare_color(color, expected2[i * 4 + j], 1),
|
||||
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected2[i * 4 + j], x, y, color);
|
||||
else
|
||||
ok(compare_color(color, expected2[i * 4 + j], 1),
|
||||
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected2[i * 4 + j], x, y, color);
|
||||
ok(compare_color(color, expected2[i * 4 + j], 1),
|
||||
"Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected2[i * 4 + j], x, y, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue