Module: wine
Branch: master
Commit: e1ab5f6e6bf251566289ccf3177ebaf8102cb72b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e1ab5f6e6bf251566289ccf31…
Author: Henri Verbeet <hverbeet(a)codeweavers.com>
Date: Sun Aug 21 21:34:55 2011 +0200
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
92e616f355ded5f3634625dba245e9b437e3ad6a.
---
dlls/wined3d/surface.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 88e8a1d..8412aa5 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -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;
}