diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index f1ba858a03d..d6358f8e521 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -3194,15 +3194,16 @@ static HRESULT WINAPI ddraw_surface1_GetFlipStatus(IDirectDrawSurface *iface, DW * Returns: * 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); 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(); - 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(); return hr; diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 2a366199c6b..57925a69993 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1931,32 +1931,6 @@ HRESULT CDECL wined3d_surface_set_overlay_position(struct wined3d_surface *surfa 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, DWORD flags, struct wined3d_surface *ref) { diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index de1d9455ba1..7c42b3c1c35 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -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); } +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, 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) diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 86d03f03bc9..082a69367cb 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -222,7 +222,6 @@ @ cdecl wined3d_stateblock_decref(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_pitch(ptr) @ 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_level_count(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_resource(ptr) @ cdecl wined3d_texture_get_sub_resource(ptr long) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 8f9d80af4a2..36e34ea6e32 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -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_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); 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); @@ -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); DWORD __cdecl wined3d_texture_get_level_count(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); 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,