wined3d: Require a valid destination point in surface_upload_from_surface().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4c8b3e0d19
commit
f243302ed5
|
@ -878,25 +878,12 @@ static HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface,
|
||||||
struct wined3d_context *context;
|
struct wined3d_context *context;
|
||||||
struct wined3d_bo_address data;
|
struct wined3d_bo_address data;
|
||||||
UINT update_w, update_h;
|
UINT update_w, update_h;
|
||||||
RECT r, dst_rect;
|
RECT r;
|
||||||
POINT p;
|
|
||||||
|
|
||||||
TRACE("dst_surface %p, dst_point %s, src_surface %p, src_rect %s.\n",
|
TRACE("dst_surface %p, dst_point %s, src_surface %p, src_rect %s.\n",
|
||||||
dst_surface, wine_dbgstr_point(dst_point),
|
dst_surface, wine_dbgstr_point(dst_point),
|
||||||
src_surface, wine_dbgstr_rect(src_rect));
|
src_surface, wine_dbgstr_rect(src_rect));
|
||||||
|
|
||||||
if (!dst_point)
|
|
||||||
{
|
|
||||||
p.x = 0;
|
|
||||||
p.y = 0;
|
|
||||||
dst_point = &p;
|
|
||||||
}
|
|
||||||
else if (dst_point->x < 0 || dst_point->y < 0)
|
|
||||||
{
|
|
||||||
WARN("Invalid destination point.\n");
|
|
||||||
return WINED3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!src_rect)
|
if (!src_rect)
|
||||||
{
|
{
|
||||||
SetRect(&r, 0, 0, wined3d_texture_get_level_width(src_texture, src_surface->texture_level),
|
SetRect(&r, 0, 0, wined3d_texture_get_level_width(src_texture, src_surface->texture_level),
|
||||||
|
@ -910,21 +897,14 @@ static HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface,
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_w = src_rect->right - src_rect->left;
|
|
||||||
update_h = src_rect->bottom - src_rect->top;
|
|
||||||
SetRect(&dst_rect, dst_point->x, dst_point->y, dst_point->x + update_w, dst_point->y + update_h);
|
|
||||||
if (!wined3d_surface_check_rect_dimensions(dst_surface, &dst_rect))
|
|
||||||
{
|
|
||||||
WARN("Destination rectangle not block-aligned.\n");
|
|
||||||
return WINED3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
context = context_acquire(dst_texture->resource.device, NULL, 0);
|
context = context_acquire(dst_texture->resource.device, NULL, 0);
|
||||||
gl_info = context->gl_info;
|
gl_info = context->gl_info;
|
||||||
|
|
||||||
/* Only load the surface for partial updates. For newly allocated texture
|
/* Only load the surface for partial updates. For newly allocated texture
|
||||||
* the texture wouldn't be the current location, and we'd upload zeroes
|
* the texture wouldn't be the current location, and we'd upload zeroes
|
||||||
* just to overwrite them again. */
|
* just to overwrite them again. */
|
||||||
|
update_w = src_rect->right - src_rect->left;
|
||||||
|
update_h = src_rect->bottom - src_rect->top;
|
||||||
if (update_w == wined3d_texture_get_level_width(dst_texture, dst_surface->texture_level)
|
if (update_w == wined3d_texture_get_level_width(dst_texture, dst_surface->texture_level)
|
||||||
&& update_h == wined3d_texture_get_level_height(dst_texture, dst_surface->texture_level))
|
&& update_h == wined3d_texture_get_level_height(dst_texture, dst_surface->texture_level))
|
||||||
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
|
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
|
||||||
|
|
Loading…
Reference in New Issue