Commit e1ab5f6e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Don't allow blits with an invalid destination rectangle when a clipper is set either.

Clippers don't really work. Previously we mostly didn't run into this because the rectangle was already rejected by ddraw_surface7_Blt(), although ddraw_surface7_BltFast() might have been affected in a couple of cases. We should of course implement clippers, but until that happens, completely rejecting the blit is better than introducing memory corruption. This fixes a regression introduced by commit 92e616f3.
parent f8ce77a5
......@@ -1307,15 +1307,18 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
surface_get_rect(dst_surface, dst_rect_in, &dst_rect);
/* The destination rect can be out of bounds on the condition
* that a clipper is set for the surface. */
if (!dst_surface->clipper && (dst_rect.left >= dst_rect.right || dst_rect.top >= dst_rect.bottom
if (dst_rect.left >= dst_rect.right || dst_rect.top >= dst_rect.bottom
|| dst_rect.left > dst_surface->resource.width || dst_rect.left < 0
|| dst_rect.top > dst_surface->resource.height || dst_rect.top < 0
|| dst_rect.right > dst_surface->resource.width || dst_rect.right < 0
|| dst_rect.bottom > dst_surface->resource.height || dst_rect.bottom < 0))
|| dst_rect.bottom > dst_surface->resource.height || dst_rect.bottom < 0)
{
WARN("Application gave us bad destination rectangle for blit without a clipper set.\n");
/* The destination rect can be out of bounds on the condition
* that a clipper is set for the surface. */
if (dst_surface->clipper)
FIXME("Blit clipping not implemented.\n");
else
WARN("The application gave us a bad destination rectangle without a clipper set.\n");
return WINEDDERR_INVALIDRECT;
}
......
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