wined3d: Clamp NULL source boxes in wined3d_device_copy_sub_resource_region().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7374c8325d
commit
7b09398a0b
|
@ -1400,9 +1400,6 @@ static HRESULT WINAPI d3d9_device_UpdateSurface(IDirect3DDevice9Ex *iface,
|
|||
TRACE("iface %p, src_surface %p, src_rect %p, dst_surface %p, dst_point %p.\n",
|
||||
iface, src_surface, src_rect, dst_surface, dst_point);
|
||||
|
||||
if (src_rect)
|
||||
wined3d_box_set(&src_box, src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
|
||||
wined3d_texture_get_sub_resource_desc(src->wined3d_texture, src->sub_resource_idx, &src_desc);
|
||||
|
@ -1416,10 +1413,15 @@ static HRESULT WINAPI d3d9_device_UpdateSurface(IDirect3DDevice9Ex *iface,
|
|||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
if (src_rect)
|
||||
wined3d_box_set(&src_box, src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1);
|
||||
else
|
||||
wined3d_box_set(&src_box, 0, 0, src_desc.width, src_desc.height, 0, 1);
|
||||
|
||||
hr = wined3d_device_copy_sub_resource_region(device->wined3d_device,
|
||||
wined3d_texture_get_resource(dst->wined3d_texture), dst->sub_resource_idx, dst_point ? dst_point->x : 0,
|
||||
dst_point ? dst_point->y : 0, 0, wined3d_texture_get_resource(src->wined3d_texture),
|
||||
src->sub_resource_idx, src_rect ? &src_box : NULL);
|
||||
src->sub_resource_idx, &src_box);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
if (FAILED(hr))
|
||||
|
|
|
@ -4125,7 +4125,10 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
|
|||
|
||||
if (!src_box)
|
||||
{
|
||||
wined3d_box_set(&b, 0, 0, src_resource->size, 1, 0, 1);
|
||||
unsigned int dst_w;
|
||||
|
||||
dst_w = dst_resource->size - dst_x;
|
||||
wined3d_box_set(&b, 0, 0, min(src_resource->size, dst_w), 1, 0, 1);
|
||||
src_box = &b;
|
||||
}
|
||||
else if ((src_box->left >= src_box->right
|
||||
|
@ -4178,8 +4181,16 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
|
|||
|
||||
if (!src_box)
|
||||
{
|
||||
wined3d_box_set(&b, 0, 0, wined3d_texture_get_level_width(src_texture, src_level),
|
||||
wined3d_texture_get_level_height(src_texture, src_level), 0, 1);
|
||||
unsigned int src_w, src_h, dst_w, dst_h, dst_level;
|
||||
|
||||
src_w = wined3d_texture_get_level_width(src_texture, src_level);
|
||||
src_h = wined3d_texture_get_level_height(src_texture, src_level);
|
||||
|
||||
dst_level = dst_sub_resource_idx % dst_texture->level_count;
|
||||
dst_w = wined3d_texture_get_level_width(dst_texture, dst_level) - dst_x;
|
||||
dst_h = wined3d_texture_get_level_height(dst_texture, dst_level) - dst_y;
|
||||
|
||||
wined3d_box_set(&b, 0, 0, min(src_w, dst_w), min(src_h, dst_h), 0, 1);
|
||||
src_box = &b;
|
||||
}
|
||||
else if (FAILED(wined3d_texture_check_box_dimensions(src_texture, src_level, src_box)))
|
||||
|
|
Loading…
Reference in New Issue