Commit ea85a1ca authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Introduce wined3d_texture_set_overlay_position().

parent 6e30b042
......@@ -3625,15 +3625,16 @@ static HRESULT WINAPI ddraw_surface1_Restore(IDirectDrawSurface *iface)
* Returns:
* DDERR_NOTAOVERLAYSURFACE, because we don't support overlays right now
*****************************************************************************/
static HRESULT WINAPI ddraw_surface7_SetOverlayPosition(IDirectDrawSurface7 *iface, LONG X, LONG Y)
static HRESULT WINAPI ddraw_surface7_SetOverlayPosition(IDirectDrawSurface7 *iface, LONG x, LONG y)
{
struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
HRESULT hr;
TRACE("iface %p, x %d, y %d.\n", iface, X, Y);
TRACE("iface %p, x %d, y %d.\n", iface, x, y);
wined3d_mutex_lock();
hr = wined3d_surface_set_overlay_position(surface->wined3d_surface, X, Y);
hr = wined3d_texture_set_overlay_position(surface->wined3d_texture,
surface->sub_resource_idx, x, y);
wined3d_mutex_unlock();
return hr;
......
......@@ -1909,28 +1909,6 @@ DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface)
return pitch;
}
HRESULT CDECL wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y)
{
LONG w, h;
TRACE("surface %p, x %d, y %d.\n", surface, x, y);
if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY))
{
WARN("Not an overlay surface.\n");
return WINEDDERR_NOTAOVERLAYSURFACE;
}
w = surface->overlay_destrect.right - surface->overlay_destrect.left;
h = surface->overlay_destrect.bottom - surface->overlay_destrect.top;
surface->overlay_destrect.left = x;
surface->overlay_destrect.top = y;
surface->overlay_destrect.right = x + w;
surface->overlay_destrect.bottom = y + h;
return WINED3D_OK;
}
HRESULT CDECL wined3d_surface_update_overlay_z_order(struct wined3d_surface *surface,
DWORD flags, struct wined3d_surface *ref)
{
......
......@@ -1376,6 +1376,33 @@ HRESULT CDECL wined3d_texture_get_overlay_position(const struct wined3d_texture
return WINED3D_OK;
}
HRESULT CDECL wined3d_texture_set_overlay_position(struct wined3d_texture *texture,
unsigned int sub_resource_idx, LONG x, LONG y)
{
struct wined3d_resource *sub_resource;
struct wined3d_surface *surface;
LONG w, h;
TRACE("texture %p, sub_resource_idx %u, x %d, y %d.\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);
w = surface->overlay_destrect.right - surface->overlay_destrect.left;
h = surface->overlay_destrect.bottom - surface->overlay_destrect.top;
surface->overlay_destrect.left = x;
surface->overlay_destrect.top = y;
surface->overlay_destrect.right = x + w;
surface->overlay_destrect.bottom = y + h;
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_set_overlay_position(ptr long long)
@ cdecl wined3d_surface_update_overlay(ptr ptr ptr ptr long ptr)
@ cdecl wined3d_surface_update_overlay_z_order(ptr long ptr)
......@@ -264,6 +263,7 @@
@ cdecl wined3d_texture_set_autogen_filter_type(ptr long)
@ cdecl wined3d_texture_set_color_key(ptr long ptr)
@ 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_vertex_declaration_create(ptr ptr long ptr ptr ptr)
......
......@@ -2476,7 +2476,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_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y);
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,
......@@ -2533,12 +2532,14 @@ struct wined3d_resource * __cdecl wined3d_texture_get_sub_resource(const struct
UINT sub_resource_idx);
ULONG __cdecl wined3d_texture_incref(struct wined3d_texture *texture);
void __cdecl wined3d_texture_preload(struct wined3d_texture *texture);
HRESULT __cdecl wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc);
HRESULT __cdecl wined3d_texture_set_autogen_filter_type(struct wined3d_texture *texture,
enum wined3d_texture_filter_type filter_type);
HRESULT __cdecl wined3d_texture_set_color_key(struct wined3d_texture *texture,
DWORD flags, const struct wined3d_color_key *color_key);
DWORD __cdecl wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod);
HRESULT __cdecl wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc);
HRESULT __cdecl wined3d_texture_set_overlay_position(struct wined3d_texture *texture,
unsigned int sub_resource_idx, LONG x, LONG y);
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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment