wined3d: Introduce wined3d_texture_get_overlay_position().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2016-02-05 21:31:02 +01:00 committed by Alexandre Julliard
parent 9628db25f6
commit 6e30b042e1
5 changed files with 39 additions and 31 deletions

View File

@ -3194,15 +3194,16 @@ static HRESULT WINAPI ddraw_surface1_GetFlipStatus(IDirectDrawSurface *iface, DW
* Returns: * Returns:
* DDERR_NOTAOVERLAYSURFACE, because it's a stub * DDERR_NOTAOVERLAYSURFACE, because it's a stub
*****************************************************************************/ *****************************************************************************/
static HRESULT WINAPI ddraw_surface7_GetOverlayPosition(IDirectDrawSurface7 *iface, LONG *X, LONG *Y) static HRESULT WINAPI ddraw_surface7_GetOverlayPosition(IDirectDrawSurface7 *iface, LONG *x, LONG *y)
{ {
struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface); struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
HRESULT hr; HRESULT hr;
TRACE("iface %p, x %p, y %p.\n", iface, X, Y); TRACE("iface %p, x %p, y %p.\n", iface, x, y);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_surface_get_overlay_position(surface->wined3d_surface, X, Y); hr = wined3d_texture_get_overlay_position(surface->wined3d_texture,
surface->sub_resource_idx, x, y);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;

View File

@ -1931,32 +1931,6 @@ HRESULT CDECL wined3d_surface_set_overlay_position(struct wined3d_surface *surfa
return WINED3D_OK; return WINED3D_OK;
} }
HRESULT CDECL wined3d_surface_get_overlay_position(const struct wined3d_surface *surface, LONG *x, LONG *y)
{
TRACE("surface %p, x %p, y %p.\n", surface, x, y);
if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY))
{
TRACE("Not an overlay surface.\n");
return WINEDDERR_NOTAOVERLAYSURFACE;
}
if (!surface->overlay_dest)
{
TRACE("Overlay not visible.\n");
*x = 0;
*y = 0;
return WINEDDERR_OVERLAYNOTVISIBLE;
}
*x = surface->overlay_destrect.left;
*y = surface->overlay_destrect.top;
TRACE("Returning position %d, %d.\n", *x, *y);
return WINED3D_OK;
}
HRESULT CDECL wined3d_surface_update_overlay_z_order(struct wined3d_surface *surface, HRESULT CDECL wined3d_surface_update_overlay_z_order(struct wined3d_surface *surface,
DWORD flags, struct wined3d_surface *ref) DWORD flags, struct wined3d_surface *ref)
{ {

View File

@ -1344,6 +1344,38 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
src_resource ? surface_from_resource(src_resource) : NULL, src_rect, flags, fx, filter); src_resource ? surface_from_resource(src_resource) : NULL, src_rect, flags, fx, filter);
} }
HRESULT CDECL wined3d_texture_get_overlay_position(const struct wined3d_texture *texture,
unsigned int sub_resource_idx, LONG *x, LONG *y)
{
struct wined3d_resource *sub_resource;
struct wined3d_surface *surface;
TRACE("texture %p, sub_resource_idx %u, x %p, y %p.\n", texture, sub_resource_idx, x, y);
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;
}
surface = surface_from_resource(sub_resource);
if (!surface->overlay_dest)
{
TRACE("Overlay not visible.\n");
*x = 0;
*y = 0;
return WINEDDERR_OVERLAYNOTVISIBLE;
}
*x = surface->overlay_destrect.left;
*y = surface->overlay_destrect.top;
TRACE("Returning position %d, %d.\n", *x, *y);
return WINED3D_OK;
}
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc, 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, 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) const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)

View File

@ -222,7 +222,6 @@
@ cdecl wined3d_stateblock_decref(ptr) @ cdecl wined3d_stateblock_decref(ptr)
@ cdecl wined3d_stateblock_incref(ptr) @ cdecl wined3d_stateblock_incref(ptr)
@ cdecl wined3d_surface_get_overlay_position(ptr ptr ptr)
@ cdecl wined3d_surface_get_parent(ptr) @ cdecl wined3d_surface_get_parent(ptr)
@ cdecl wined3d_surface_get_pitch(ptr) @ cdecl wined3d_surface_get_pitch(ptr)
@ cdecl wined3d_surface_set_overlay_position(ptr long long) @ cdecl wined3d_surface_set_overlay_position(ptr long long)
@ -255,6 +254,7 @@
@ cdecl wined3d_texture_get_dc(ptr long ptr) @ cdecl wined3d_texture_get_dc(ptr long ptr)
@ cdecl wined3d_texture_get_level_count(ptr) @ cdecl wined3d_texture_get_level_count(ptr)
@ cdecl wined3d_texture_get_lod(ptr) @ cdecl wined3d_texture_get_lod(ptr)
@ cdecl wined3d_texture_get_overlay_position(ptr long ptr ptr)
@ cdecl wined3d_texture_get_parent(ptr) @ cdecl wined3d_texture_get_parent(ptr)
@ cdecl wined3d_texture_get_resource(ptr) @ cdecl wined3d_texture_get_resource(ptr)
@ cdecl wined3d_texture_get_sub_resource(ptr long) @ cdecl wined3d_texture_get_sub_resource(ptr long)

View File

@ -2474,7 +2474,6 @@ HRESULT __cdecl wined3d_stateblock_create(struct wined3d_device *device,
ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock); ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock);
ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock); ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock);
HRESULT __cdecl wined3d_surface_get_overlay_position(const struct wined3d_surface *surface, LONG *x, LONG *y);
void * __cdecl wined3d_surface_get_parent(const struct wined3d_surface *surface); void * __cdecl wined3d_surface_get_parent(const struct wined3d_surface *surface);
DWORD __cdecl wined3d_surface_get_pitch(const struct wined3d_surface *surface); DWORD __cdecl wined3d_surface_get_pitch(const struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y); HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y);
@ -2526,6 +2525,8 @@ enum wined3d_texture_filter_type __cdecl wined3d_texture_get_autogen_filter_type
HRESULT __cdecl wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc); HRESULT __cdecl wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc);
DWORD __cdecl wined3d_texture_get_level_count(const struct wined3d_texture *texture); DWORD __cdecl wined3d_texture_get_level_count(const struct wined3d_texture *texture);
DWORD __cdecl wined3d_texture_get_lod(const struct wined3d_texture *texture); DWORD __cdecl wined3d_texture_get_lod(const struct wined3d_texture *texture);
HRESULT __cdecl wined3d_texture_get_overlay_position(const struct wined3d_texture *texture,
unsigned int sub_resource_idx, LONG *x, LONG *y);
void * __cdecl wined3d_texture_get_parent(const struct wined3d_texture *texture); void * __cdecl wined3d_texture_get_parent(const struct wined3d_texture *texture);
struct wined3d_resource * __cdecl wined3d_texture_get_resource(struct wined3d_texture *texture); struct wined3d_resource * __cdecl wined3d_texture_get_resource(struct wined3d_texture *texture);
struct wined3d_resource * __cdecl wined3d_texture_get_sub_resource(const struct wined3d_texture *texture, struct wined3d_resource * __cdecl wined3d_texture_get_sub_resource(const struct wined3d_texture *texture,