From 96dd79375601923ab159ce451a049db0fb813b9b Mon Sep 17 00:00:00 2001 From: Riccardo Bortolato Date: Wed, 28 Oct 2015 14:02:13 +0100 Subject: [PATCH] wined3d: Introduce wined3d_texture_release_dc(). Signed-off-by: Riccardo Bortolato Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d9/surface.c | 2 +- dlls/wined3d/texture.c | 18 ++++++++++++++++++ dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c index 1a2cd54041..58d2309c83 100644 --- a/dlls/d3d9/surface.c +++ b/dlls/d3d9/surface.c @@ -311,7 +311,7 @@ static HRESULT WINAPI d3d9_surface_ReleaseDC(IDirect3DSurface9 *iface, HDC dc) TRACE("iface %p, dc %p.\n", iface, dc); wined3d_mutex_lock(); - hr = wined3d_surface_releasedc(surface->wined3d_surface, dc); + hr = wined3d_texture_release_dc(surface->wined3d_texture, surface->sub_resource_idx, dc); wined3d_mutex_unlock(); switch (hr) diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index ef19ac1934..057211e3bf 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1558,3 +1558,21 @@ HRESULT CDECL wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned i return wined3d_surface_getdc(surface_from_resource(sub_resource), dc); } + +HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc) +{ + struct wined3d_resource *sub_resource; + + TRACE("texture %p, sub_resource_idx %u, dc %p.\n", texture, sub_resource_idx, dc); + + if (!(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx))) + return WINED3DERR_INVALIDCALL; + + if (sub_resource->type != WINED3D_RTYPE_SURFACE) + { + WARN("Not supported on %s resources.\n", debug_d3dresourcetype(texture->resource.type)); + return WINED3DERR_INVALIDCALL; + } + + return wined3d_surface_releasedc(surface_from_resource(sub_resource), dc); +} diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 8466844944..219c190cbf 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -270,6 +270,7 @@ @ cdecl wined3d_texture_get_sub_resource(ptr long) @ cdecl wined3d_texture_incref(ptr) @ cdecl wined3d_texture_preload(ptr) +@ cdecl wined3d_texture_release_dc(ptr long ptr) @ 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) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 8c174e058f..9cc1e1cf3b 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2553,6 +2553,7 @@ HRESULT __cdecl wined3d_texture_set_color_key(struct wined3d_texture *texture, DWORD __cdecl wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod); HRESULT __cdecl wined3d_texture_map(struct wined3d_texture *texture, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, DWORD flags); +HRESULT __cdecl wined3d_texture_release_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC dc); HRESULT __cdecl wined3d_texture_unmap(struct wined3d_texture *texture, unsigned int sub_resource_idx); HRESULT __cdecl wined3d_texture_update_desc(struct wined3d_texture *texture, UINT width, UINT height, enum wined3d_format_id format_id,