wined3d: Introduce wined3d_texture_update_overlay().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f614d7fa52
commit
02008a6f2e
|
@ -3691,22 +3691,30 @@ static HRESULT WINAPI ddraw_surface1_SetOverlayPosition(IDirectDrawSurface *ifac
|
|||
* DDERR_UNSUPPORTED, because we don't support overlays
|
||||
*
|
||||
*****************************************************************************/
|
||||
static HRESULT WINAPI ddraw_surface7_UpdateOverlay(IDirectDrawSurface7 *iface, RECT *SrcRect,
|
||||
IDirectDrawSurface7 *DstSurface, RECT *DstRect, DWORD Flags, DDOVERLAYFX *FX)
|
||||
static HRESULT WINAPI ddraw_surface7_UpdateOverlay(IDirectDrawSurface7 *iface, RECT *src_rect,
|
||||
IDirectDrawSurface7 *dst_surface, RECT *dst_rect, DWORD flags, DDOVERLAYFX *fx)
|
||||
{
|
||||
struct ddraw_surface *src_impl = impl_from_IDirectDrawSurface7(iface);
|
||||
struct ddraw_surface *dst_impl = unsafe_impl_from_IDirectDrawSurface7(DstSurface);
|
||||
struct ddraw_surface *dst_impl = unsafe_impl_from_IDirectDrawSurface7(dst_surface);
|
||||
struct wined3d_texture *dst_wined3d_texture = NULL;
|
||||
unsigned int dst_sub_resource_idx = 0;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n",
|
||||
iface, wine_dbgstr_rect(SrcRect), DstSurface, wine_dbgstr_rect(DstRect), Flags, FX);
|
||||
iface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_surface_update_overlay(src_impl->wined3d_surface, SrcRect,
|
||||
dst_impl ? dst_impl->wined3d_surface : NULL, DstRect, Flags, (WINEDDOVERLAYFX *)FX);
|
||||
if (dst_impl)
|
||||
{
|
||||
dst_wined3d_texture = dst_impl->wined3d_texture;
|
||||
dst_sub_resource_idx = dst_impl->sub_resource_idx;
|
||||
}
|
||||
hr = wined3d_texture_update_overlay(src_impl->wined3d_texture, src_impl->sub_resource_idx, src_rect,
|
||||
dst_wined3d_texture, dst_sub_resource_idx, dst_rect, flags, (WINEDDOVERLAYFX *)fx);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
switch(hr) {
|
||||
switch (hr)
|
||||
{
|
||||
case WINED3DERR_INVALIDCALL: return DDERR_INVALIDPARAMS;
|
||||
case WINEDDERR_NOTAOVERLAYSURFACE: return DDERR_NOTAOVERLAYSURFACE;
|
||||
case WINEDDERR_OVERLAYNOTVISIBLE: return DDERR_OVERLAYNOTVISIBLE;
|
||||
|
|
|
@ -1923,53 +1923,6 @@ HRESULT CDECL wined3d_surface_update_overlay_z_order(struct wined3d_surface *sur
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_surface_update_overlay(struct wined3d_surface *surface, const RECT *src_rect,
|
||||
struct wined3d_surface *dst_surface, const RECT *dst_rect, DWORD flags, const WINEDDOVERLAYFX *fx)
|
||||
{
|
||||
TRACE("surface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n",
|
||||
surface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx);
|
||||
|
||||
if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY))
|
||||
{
|
||||
WARN("Not an overlay surface.\n");
|
||||
return WINEDDERR_NOTAOVERLAYSURFACE;
|
||||
}
|
||||
else if (!dst_surface)
|
||||
{
|
||||
WARN("Dest surface is NULL.\n");
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
surface_get_rect(surface, src_rect, &surface->overlay_srcrect);
|
||||
surface_get_rect(dst_surface, dst_rect, &surface->overlay_destrect);
|
||||
|
||||
if (surface->overlay_dest && (surface->overlay_dest != dst_surface || flags & WINEDDOVER_HIDE))
|
||||
{
|
||||
surface->overlay_dest = NULL;
|
||||
list_remove(&surface->overlay_entry);
|
||||
}
|
||||
|
||||
if (flags & WINEDDOVER_SHOW)
|
||||
{
|
||||
if (surface->overlay_dest != dst_surface)
|
||||
{
|
||||
surface->overlay_dest = dst_surface;
|
||||
list_add_tail(&dst_surface->overlays, &surface->overlay_entry);
|
||||
}
|
||||
}
|
||||
else if (flags & WINEDDOVER_HIDE)
|
||||
{
|
||||
/* tests show that the rectangles are erased on hide */
|
||||
surface->overlay_srcrect.left = 0; surface->overlay_srcrect.top = 0;
|
||||
surface->overlay_srcrect.right = 0; surface->overlay_srcrect.bottom = 0;
|
||||
surface->overlay_destrect.left = 0; surface->overlay_destrect.top = 0;
|
||||
surface->overlay_destrect.right = 0; surface->overlay_destrect.bottom = 0;
|
||||
surface->overlay_dest = NULL;
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT wined3d_surface_update_desc(struct wined3d_surface *surface,
|
||||
const struct wined3d_gl_info *gl_info, void *mem, unsigned int pitch)
|
||||
{
|
||||
|
|
|
@ -1402,6 +1402,71 @@ HRESULT CDECL wined3d_texture_set_overlay_position(struct wined3d_texture *textu
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_texture_update_overlay(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
const RECT *src_rect, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
|
||||
const RECT *dst_rect, DWORD flags, const WINEDDOVERLAYFX *fx)
|
||||
{
|
||||
struct wined3d_resource *sub_resource, *dst_sub_resource;
|
||||
struct wined3d_surface *surface, *dst_surface;
|
||||
|
||||
TRACE("texture %p, sub_resource_idx %u, src_rect %s, dst_texture %p, "
|
||||
"dst_sub_resource_idx %u, dst_rect %s, flags %#x, fx %p.\n",
|
||||
texture, sub_resource_idx, wine_dbgstr_rect(src_rect), dst_texture,
|
||||
dst_sub_resource_idx, wine_dbgstr_rect(dst_rect), flags, fx);
|
||||
|
||||
if (!(texture->resource.usage & WINED3DUSAGE_OVERLAY) || texture->resource.type != WINED3D_RTYPE_TEXTURE_2D
|
||||
|| !(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx)))
|
||||
{
|
||||
WARN("Invalid sub-resource specified.\n");
|
||||
return WINEDDERR_NOTAOVERLAYSURFACE;
|
||||
}
|
||||
|
||||
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)))
|
||||
{
|
||||
WARN("Invalid destination sub-resource specified.\n");
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
surface = surface_from_resource(sub_resource);
|
||||
if (src_rect)
|
||||
surface->overlay_srcrect = *src_rect;
|
||||
else
|
||||
SetRect(&surface->overlay_srcrect, 0, 0, surface->resource.width, surface->resource.height);
|
||||
|
||||
dst_surface = surface_from_resource(dst_sub_resource);
|
||||
if (dst_rect)
|
||||
surface->overlay_destrect = *dst_rect;
|
||||
else
|
||||
SetRect(&surface->overlay_destrect, 0, 0, dst_surface->resource.width, dst_surface->resource.height);
|
||||
|
||||
if (surface->overlay_dest && (surface->overlay_dest != dst_surface || flags & WINEDDOVER_HIDE))
|
||||
{
|
||||
surface->overlay_dest = NULL;
|
||||
list_remove(&surface->overlay_entry);
|
||||
}
|
||||
|
||||
if (flags & WINEDDOVER_SHOW)
|
||||
{
|
||||
if (surface->overlay_dest != dst_surface)
|
||||
{
|
||||
surface->overlay_dest = dst_surface;
|
||||
list_add_tail(&dst_surface->overlays, &surface->overlay_entry);
|
||||
}
|
||||
}
|
||||
else if (flags & WINEDDOVER_HIDE)
|
||||
{
|
||||
/* Tests show that the rectangles are erased on hide. */
|
||||
surface->overlay_srcrect.left = 0; surface->overlay_srcrect.top = 0;
|
||||
surface->overlay_srcrect.right = 0; surface->overlay_srcrect.bottom = 0;
|
||||
surface->overlay_destrect.left = 0; surface->overlay_destrect.top = 0;
|
||||
surface->overlay_destrect.right = 0; surface->overlay_destrect.bottom = 0;
|
||||
surface->overlay_dest = NULL;
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc,
|
||||
UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent,
|
||||
const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
|
||||
|
|
|
@ -224,7 +224,6 @@
|
|||
|
||||
@ cdecl wined3d_surface_get_parent(ptr)
|
||||
@ cdecl wined3d_surface_get_pitch(ptr)
|
||||
@ cdecl wined3d_surface_update_overlay(ptr ptr ptr ptr long ptr)
|
||||
@ cdecl wined3d_surface_update_overlay_z_order(ptr long ptr)
|
||||
|
||||
@ cdecl wined3d_swapchain_create(ptr ptr ptr ptr ptr)
|
||||
|
@ -265,6 +264,7 @@
|
|||
@ cdecl wined3d_texture_set_lod(ptr long)
|
||||
@ cdecl wined3d_texture_set_overlay_position(ptr long long long)
|
||||
@ cdecl wined3d_texture_update_desc(ptr long long long long long ptr long)
|
||||
@ cdecl wined3d_texture_update_overlay(ptr long ptr ptr long ptr long ptr)
|
||||
|
||||
@ cdecl wined3d_vertex_declaration_create(ptr ptr long ptr ptr ptr)
|
||||
@ cdecl wined3d_vertex_declaration_create_from_fvf(ptr long ptr ptr ptr)
|
||||
|
|
|
@ -2477,8 +2477,6 @@ ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock);
|
|||
|
||||
void * __cdecl wined3d_surface_get_parent(const struct wined3d_surface *surface);
|
||||
DWORD __cdecl wined3d_surface_get_pitch(const struct wined3d_surface *surface);
|
||||
HRESULT __cdecl wined3d_surface_update_overlay(struct wined3d_surface *surface, const RECT *src_rect,
|
||||
struct wined3d_surface *dst_surface, const RECT *dst_rect, DWORD flags, const WINEDDOVERLAYFX *fx);
|
||||
HRESULT __cdecl wined3d_surface_update_overlay_z_order(struct wined3d_surface *surface,
|
||||
DWORD flags, struct wined3d_surface *ref);
|
||||
|
||||
|
@ -2545,6 +2543,9 @@ HRESULT __cdecl wined3d_texture_update_desc(struct wined3d_texture *texture,
|
|||
UINT width, UINT height, enum wined3d_format_id format_id,
|
||||
enum wined3d_multisample_type multisample_type, UINT multisample_quality,
|
||||
void *mem, UINT pitch);
|
||||
HRESULT __cdecl wined3d_texture_update_overlay(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
const RECT *src_rect, struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
|
||||
const RECT *dst_rect, DWORD flags, const WINEDDOVERLAYFX *fx);
|
||||
|
||||
HRESULT __cdecl wined3d_vertex_declaration_create(struct wined3d_device *device,
|
||||
const struct wined3d_vertex_element *elements, UINT element_count, void *parent,
|
||||
|
|
Loading…
Reference in New Issue