Module: wine Branch: master Commit: c19c26e4be76e206043f8a81b5b5f39589df4cbd URL: http://source.winehq.org/git/wine.git/?a=commit;h=c19c26e4be76e206043f8a81b5...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Tue Jun 14 20:28:10 2011 +0200
wined3d: Check the source rectangle is a multiple of the format block size in wined3d_device_update_surface().
---
dlls/wined3d/device.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index d907d9a..ba5db37 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4741,6 +4741,7 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device, UINT update_w, update_h; CONVERT_TYPES convert; UINT dst_w, dst_h; + UINT src_w, src_h; DWORD sampler; POINT p; RECT r; @@ -4792,6 +4793,9 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; }
+ src_w = src_surface->resource.width; + src_h = src_surface->resource.height; + dst_w = dst_surface->resource.width; dst_h = dst_surface->resource.height;
@@ -4805,6 +4809,14 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device, return WINED3DERR_INVALIDCALL; }
+ /* NPOT block sizes would be silly. */ + if ((update_w & (src_format->block_width - 1) || update_h & (src_format->block_height - 1)) + && (src_w != update_w || dst_w != update_w || src_h != update_h || dst_h != update_h)) + { + WARN("Update rect not block-aligned.\n"); + return WINED3DERR_INVALIDCALL; + } + /* This call loads the OpenGL surface directly, instead of copying the * surface to the destination's sysmem copy. If surface conversion is * needed, use BltFast instead to copy in sysmem and use regular surface @@ -4831,8 +4843,7 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device, if (!data.addr) ERR("Source surface has no allocated memory, but should be a sysmem surface.\n");
- surface_upload_data(dst_surface, gl_info, src_format, src_rect, - src_surface->resource.width, dst_point, FALSE, &data); + surface_upload_data(dst_surface, gl_info, src_format, src_rect, src_w, dst_point, FALSE, &data);
context_release(context);