From: Paul Gofman <pgofman@codeweavers.com> --- dlls/ddraw/surface.c | 18 +++++++++--------- dlls/ddraw/tests/ddraw1.c | 9 +++++++-- dlls/ddraw/tests/ddraw2.c | 9 +++++++-- dlls/ddraw/tests/ddraw4.c | 9 +++++++-- dlls/ddraw/tests/ddraw7.c | 9 +++++++-- 5 files changed, 37 insertions(+), 17 deletions(-) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index e6ed79afccf..139bf45921d 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -1647,7 +1647,14 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons SetRectEmpty(&src_rect); } - if (!dst_surface->clipper) + if (dst_surface->clipper && !ddraw_clipper_is_valid(dst_surface->clipper)) + { + FIXME("Attempting to blit with an invalid clipper.\n"); + return DDERR_INVALIDPARAMS; + } + + if (!dst_surface->clipper || (dst_surface->ddraw->cooperative_level & DDSCL_EXCLUSIVE + && dst_surface->clipper->window)) { if (src_surface && src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) hr = ddraw_surface_update_frontbuffer(src_surface, &src_rect, TRUE, 0); @@ -1659,12 +1666,6 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons return hr; } - if (!ddraw_clipper_is_valid(dst_surface->clipper)) - { - FIXME("Attempting to blit with an invalid clipper.\n"); - return DDERR_INVALIDPARAMS; - } - scale_x = (float)(src_rect.right - src_rect.left) / (float)(dst_rect.right - dst_rect.left); scale_y = (float)(src_rect.bottom - src_rect.top) / (float)(dst_rect.bottom - dst_rect.top); @@ -4644,9 +4645,8 @@ static HRESULT WINAPI ddraw_surface7_SetClipper(IDirectDrawSurface7 *iface, if ((This->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) && This->ddraw->wined3d_swapchain) { clipWindow = NULL; - if(clipper) { + if (clipper && !(This->ddraw->cooperative_level & DDSCL_EXCLUSIVE)) IDirectDrawClipper_GetHWnd(iclipper, &clipWindow); - } if (clipWindow) { diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 594baee6ff9..b632354f88b 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -16426,9 +16426,9 @@ static void check_surface_clipper(IDirectDrawSurface *surface, IDirectDrawClippe ok(hr == DD_OK, "got %#lx.\n", hr); c = get_surface_color(surface, window_rect->left + 1, window_rect->top + 1); - todo_wine_if(!(style & WS_VISIBLE)) ok(c == 0x0000ff00, "got %#x.\n", c); + ok(c == 0x0000ff00, "got %#x.\n", c); c = get_surface_color(surface, 0, 0); - todo_wine_if((style & (WS_CHILD | WS_VISIBLE)) != (WS_CHILD | WS_VISIBLE)) ok(c == 0x0000ff00, "got %#x.\n", c); + ok(c == 0x0000ff00, "got %#x.\n", c); hr = IDirectDrawSurface_SetClipper(surface, NULL); ok(hr == DD_OK, "got %#lx.\n", hr); @@ -16477,6 +16477,8 @@ static void test_clipper_in_exclusive_fullscreen(void) window = CreateWindowA("static", "ddraw_fullscreen", WS_POPUP | WS_VISIBLE, 0, 0, 640, 480, NULL, NULL, NULL, NULL); pump_messages(); + hr = IDirectDraw_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); + ok(hr == DD_OK, "got %#lx.\n", hr); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(hr == DD_OK, "got %#lx.\n", hr); pump_messages(); @@ -16554,7 +16556,10 @@ static void test_clipper_in_exclusive_fullscreen(void) winetest_pop_context(); } + hr = IDirectDraw_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); + ok(hr == DD_OK, "got %#lx.\n", hr); IDirectDrawClipper_Release(clipper); + IDirectDrawClipper_Release(clipper2); refcount = IDirectDrawSurface_Release(offscreen); ok(!refcount, "Got unexpected refcount %lu.\n", refcount); refcount = IDirectDrawSurface_Release(primary); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index ebbc20aacac..def4b26626f 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -17497,9 +17497,9 @@ static void check_surface_clipper(IDirectDrawSurface *surface, IDirectDrawClippe ok(hr == DD_OK, "got %#lx.\n", hr); c = get_surface_color(surface, window_rect->left + 1, window_rect->top + 1); - todo_wine_if(!(style & WS_VISIBLE)) ok(c == 0x0000ff00, "got %#x.\n", c); + ok(c == 0x0000ff00, "got %#x.\n", c); c = get_surface_color(surface, 0, 0); - todo_wine_if((style & (WS_CHILD | WS_VISIBLE)) != (WS_CHILD | WS_VISIBLE)) ok(c == 0x0000ff00, "got %#x.\n", c); + ok(c == 0x0000ff00, "got %#x.\n", c); hr = IDirectDrawSurface_SetClipper(surface, NULL); ok(hr == DD_OK, "got %#lx.\n", hr); @@ -17548,6 +17548,8 @@ static void test_clipper_in_exclusive_fullscreen(void) window = CreateWindowA("static", "ddraw_fullscreen", WS_POPUP | WS_VISIBLE, 0, 0, 640, 480, NULL, NULL, NULL, NULL); pump_messages(); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); + ok(hr == DD_OK, "got %#lx.\n", hr); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(hr == DD_OK, "got %#lx.\n", hr); pump_messages(); @@ -17625,7 +17627,10 @@ static void test_clipper_in_exclusive_fullscreen(void) winetest_pop_context(); } + hr = IDirectDraw2_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); + ok(hr == DD_OK, "got %#lx.\n", hr); IDirectDrawClipper_Release(clipper); + IDirectDrawClipper_Release(clipper2); refcount = IDirectDrawSurface_Release(offscreen); ok(!refcount, "Got unexpected refcount %lu.\n", refcount); refcount = IDirectDrawSurface_Release(primary); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index e2fa4738cbc..8710c8926a5 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -20596,9 +20596,9 @@ static void check_surface_clipper(IDirectDrawSurface4 *surface, IDirectDrawClipp ok(hr == DD_OK, "got %#lx.\n", hr); c = get_surface_color(surface, window_rect->left + 1, window_rect->top + 1); - todo_wine_if(!(style & WS_VISIBLE)) ok(c == 0x0000ff00, "got %#x.\n", c); + ok(c == 0x0000ff00, "got %#x.\n", c); c = get_surface_color(surface, 0, 0); - todo_wine_if((style & (WS_CHILD | WS_VISIBLE)) != (WS_CHILD | WS_VISIBLE)) ok(c == 0x0000ff00, "got %#x.\n", c); + ok(c == 0x0000ff00, "got %#x.\n", c); hr = IDirectDrawSurface4_SetClipper(surface, NULL); ok(hr == DD_OK, "got %#lx.\n", hr); @@ -20647,6 +20647,8 @@ static void test_clipper_in_exclusive_fullscreen(void) window = CreateWindowA("static", "ddraw_fullscreen", WS_POPUP | WS_VISIBLE, 0, 0, 640, 480, NULL, NULL, NULL, NULL); pump_messages(); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); + ok(hr == DD_OK, "got %#lx.\n", hr); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(hr == DD_OK, "got %#lx.\n", hr); pump_messages(); @@ -20724,7 +20726,10 @@ static void test_clipper_in_exclusive_fullscreen(void) winetest_pop_context(); } + hr = IDirectDraw4_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); + ok(hr == DD_OK, "got %#lx.\n", hr); IDirectDrawClipper_Release(clipper); + IDirectDrawClipper_Release(clipper2); refcount = IDirectDrawSurface4_Release(offscreen); ok(!refcount, "Got unexpected refcount %lu.\n", refcount); refcount = IDirectDrawSurface4_Release(primary); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index eb35cfa6792..9a68421af4e 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -20994,9 +20994,9 @@ static void check_surface_clipper(IDirectDrawSurface7 *surface, IDirectDrawClipp ok(hr == DD_OK, "got %#lx.\n", hr); c = get_surface_color(surface, window_rect->left + 1, window_rect->top + 1); - todo_wine_if(!(style & WS_VISIBLE)) ok(c == 0x0000ff00, "got %#x.\n", c); + ok(c == 0x0000ff00, "got %#x.\n", c); c = get_surface_color(surface, 0, 0); - todo_wine_if((style & (WS_CHILD | WS_VISIBLE)) != (WS_CHILD | WS_VISIBLE)) ok(c == 0x0000ff00, "got %#x.\n", c); + ok(c == 0x0000ff00, "got %#x.\n", c); hr = IDirectDrawSurface7_SetClipper(surface, NULL); ok(hr == DD_OK, "got %#lx.\n", hr); @@ -21045,6 +21045,8 @@ static void test_clipper_in_exclusive_fullscreen(void) window = CreateWindowA("static", "ddraw_fullscreen", WS_POPUP | WS_VISIBLE, 0, 0, 640, 480, NULL, NULL, NULL, NULL); pump_messages(); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); + ok(hr == DD_OK, "got %#lx.\n", hr); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(hr == DD_OK, "got %#lx.\n", hr); pump_messages(); @@ -21122,7 +21124,10 @@ static void test_clipper_in_exclusive_fullscreen(void) winetest_pop_context(); } + hr = IDirectDraw7_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); + ok(hr == DD_OK, "got %#lx.\n", hr); IDirectDrawClipper_Release(clipper); + IDirectDrawClipper_Release(clipper2); refcount = IDirectDrawSurface7_Release(offscreen); ok(!refcount, "Got unexpected refcount %lu.\n", refcount); refcount = IDirectDrawSurface7_Release(primary); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10723