From a206f43648304f3c54b03f98765677ae0b5eecd0 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 12 Jan 2012 21:43:09 +0100 Subject: [PATCH] wined3d: Get rid of wined3d_surface_set_format(). --- dlls/d3d8/device.c | 9 ++++++++- dlls/wined3d/surface.c | 24 ------------------------ dlls/wined3d/wined3d.spec | 1 - include/wine/wined3d.h | 1 - 4 files changed, 8 insertions(+), 27 deletions(-) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 16a0b377e5b..043f582656b 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -932,6 +932,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(IDirect3DDevice8 *iface, struct wined3d_resource_desc wined3d_desc; struct wined3d_resource *wined3d_resource; UINT src_w, src_h; + HRESULT hr; TRACE("iface %p, src_surface %p, src_rects %p, rect_count %u, dst_surface %p, dst_points %p.\n", iface, pSourceSurface, pSourceRects, cRects, pDestinationSurface, pDestPoints); @@ -961,7 +962,13 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(IDirect3DDevice8 *iface, else if (WINED3DFMT_UNKNOWN == destFormat) { TRACE("(%p) : Converting destination surface from WINED3DFMT_UNKNOWN to the source format\n", iface); - wined3d_surface_set_format(Dest->wined3d_surface, srcFormat); + if (FAILED(hr = wined3d_surface_update_desc(Dest->wined3d_surface, wined3d_desc.width, wined3d_desc.height, + srcFormat, wined3d_desc.multisample_type, wined3d_desc.multisample_quality))) + { + WARN("Failed to update surface desc, hr %#x.\n", hr); + wined3d_mutex_unlock(); + return hr; + } } /* Quick if complete copy ... */ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 2cf01f988e9..494504198e2 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -3378,30 +3378,6 @@ HRESULT CDECL wined3d_surface_update_desc(struct wined3d_surface *surface, return WINED3D_OK; } -HRESULT CDECL wined3d_surface_set_format(struct wined3d_surface *surface, enum wined3d_format_id format_id) -{ - const struct wined3d_format *format = wined3d_get_format(&surface->resource.device->adapter->gl_info, format_id); - - TRACE("surface %p, format %s.\n", surface, debug_d3dformat(format_id)); - - if (surface->resource.format->id != WINED3DFMT_UNKNOWN) - { - FIXME("The format of the surface must be WINED3DFORMAT_UNKNOWN.\n"); - return WINED3DERR_INVALIDCALL; - } - - surface->resource.size = wined3d_format_calculate_size(format, surface->resource.device->surface_alignment, - surface->pow2Width, surface->pow2Height); - surface->flags |= (WINED3DFMT_D16_LOCKABLE == format_id) ? SFLAG_LOCKABLE : 0; - surface->resource.format = format; - - TRACE("size %u, byte_count %u\n", surface->resource.size, format->byte_count); - TRACE("glFormat %#x, glInternal %#x, glType %#x.\n", - format->glFormat, format->glInternal, format->glType); - - return WINED3D_OK; -} - static void convert_r32_float_r16_float(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h) { diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 8279aa6fd54..f0821fbc312 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -211,7 +211,6 @@ @ cdecl wined3d_surface_releasedc(ptr ptr) @ cdecl wined3d_surface_restore(ptr) @ cdecl wined3d_surface_set_color_key(ptr long ptr) -@ cdecl wined3d_surface_set_format(ptr long) @ cdecl wined3d_surface_set_mem(ptr ptr) @ cdecl wined3d_surface_set_overlay_position(ptr long long) @ cdecl wined3d_surface_set_palette(ptr ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index b423dd8cae9..5759f4ac75f 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2328,7 +2328,6 @@ HRESULT __cdecl wined3d_surface_releasedc(struct wined3d_surface *surface, HDC d HRESULT __cdecl wined3d_surface_restore(struct wined3d_surface *surface); HRESULT __cdecl wined3d_surface_set_color_key(struct wined3d_surface *surface, DWORD flags, const struct wined3d_color_key *color_key); -HRESULT __cdecl wined3d_surface_set_format(struct wined3d_surface *surface, enum wined3d_format_id format_id); HRESULT __cdecl wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem); HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y); HRESULT __cdecl wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette);