wined3d: Store the destination as texture + sub-resource index in struct wined3d_overlay_info.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-03-15 11:38:38 +03:30 committed by Alexandre Julliard
parent 32eef26a7d
commit 47404a7db6
2 changed files with 11 additions and 11 deletions

View File

@ -2866,7 +2866,7 @@ HRESULT CDECL wined3d_texture_get_overlay_position(const struct wined3d_texture
}
overlay = &texture->overlay_info[sub_resource_idx];
if (!overlay->dst)
if (!overlay->dst_texture)
{
TRACE("Overlay not visible.\n");
*x = 0;
@ -2909,9 +2909,7 @@ HRESULT CDECL wined3d_texture_update_overlay(struct wined3d_texture *texture, un
const RECT *src_rect, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
const RECT *dst_rect, DWORD flags)
{
struct wined3d_texture_sub_resource *dst_sub_resource;
struct wined3d_overlay_info *overlay;
struct wined3d_surface *dst_surface;
unsigned int level, dst_level;
TRACE("texture %p, sub_resource_idx %u, src_rect %s, dst_texture %p, "
@ -2927,7 +2925,7 @@ HRESULT CDECL wined3d_texture_update_overlay(struct wined3d_texture *texture, un
}
if (!dst_texture || dst_texture->resource.type != WINED3D_RTYPE_TEXTURE_2D
|| !(dst_sub_resource = wined3d_texture_get_sub_resource(dst_texture, dst_sub_resource_idx)))
|| dst_sub_resource_idx >= dst_texture->level_count * dst_texture->layer_count)
{
WARN("Invalid destination sub-resource specified.\n");
return WINED3DERR_INVALIDCALL;
@ -2943,7 +2941,6 @@ HRESULT CDECL wined3d_texture_update_overlay(struct wined3d_texture *texture, un
wined3d_texture_get_level_width(texture, level),
wined3d_texture_get_level_height(texture, level));
dst_surface = dst_sub_resource->u.surface;
dst_level = dst_sub_resource_idx % dst_texture->level_count;
if (dst_rect)
overlay->dst_rect = *dst_rect;
@ -2952,17 +2949,19 @@ HRESULT CDECL wined3d_texture_update_overlay(struct wined3d_texture *texture, un
wined3d_texture_get_level_width(dst_texture, dst_level),
wined3d_texture_get_level_height(dst_texture, dst_level));
if (overlay->dst && (overlay->dst != dst_surface || flags & WINEDDOVER_HIDE))
if (overlay->dst_texture && (overlay->dst_texture != dst_texture
|| overlay->dst_sub_resource_idx != dst_sub_resource_idx || flags & WINEDDOVER_HIDE))
{
overlay->dst = NULL;
overlay->dst_texture = NULL;
list_remove(&overlay->entry);
}
if (flags & WINEDDOVER_SHOW)
{
if (overlay->dst != dst_surface)
if (overlay->dst_texture != dst_texture || overlay->dst_sub_resource_idx != dst_sub_resource_idx)
{
overlay->dst = dst_surface;
overlay->dst_texture = dst_texture;
overlay->dst_sub_resource_idx = dst_sub_resource_idx;
list_add_tail(&texture->overlay_info[dst_sub_resource_idx].overlays, &overlay->entry);
}
}
@ -2971,7 +2970,7 @@ HRESULT CDECL wined3d_texture_update_overlay(struct wined3d_texture *texture, un
/* Tests show that the rectangles are erased on hide. */
SetRectEmpty(&overlay->src_rect);
SetRectEmpty(&overlay->dst_rect);
overlay->dst = NULL;
overlay->dst_texture = NULL;
}
return WINED3D_OK;

View File

@ -3158,7 +3158,8 @@ struct wined3d_texture
{
struct list entry;
struct list overlays;
struct wined3d_surface *dst;
struct wined3d_texture *dst_texture;
unsigned int dst_sub_resource_idx;
RECT src_rect;
RECT dst_rect;
} *overlay_info;