ddraw: Make ddraw_surface_init() static.

This commit is contained in:
Zebediah Figura 2022-12-25 01:06:43 -06:00 committed by Alexandre Julliard
parent 87cd13903c
commit 107c260893
2 changed files with 43 additions and 45 deletions

View file

@ -238,8 +238,6 @@ struct ddraw_texture
HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc, HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc,
struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version) DECLSPEC_HIDDEN; struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version) DECLSPEC_HIDDEN;
struct wined3d_rendertarget_view *ddraw_surface_get_rendertarget_view(struct ddraw_surface *surface) DECLSPEC_HIDDEN; struct wined3d_rendertarget_view *ddraw_surface_get_rendertarget_view(struct ddraw_surface *surface) DECLSPEC_HIDDEN;
void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface, HRESULT ddraw_surface_update_frontbuffer(struct ddraw_surface *surface,
const RECT *rect, BOOL read, unsigned int swap_interval) DECLSPEC_HIDDEN; const RECT *rect, BOOL read, unsigned int swap_interval) DECLSPEC_HIDDEN;

View file

@ -5912,6 +5912,49 @@ static const struct wined3d_parent_ops ddraw_surface_wined3d_parent_ops =
ddraw_surface_wined3d_object_destroyed, ddraw_surface_wined3d_object_destroyed,
}; };
static void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx)
{
struct ddraw_texture *texture = wined3d_texture_get_parent(wined3d_texture);
unsigned int version = texture->version;
surface->IDirectDrawSurface7_iface.lpVtbl = &ddraw_surface7_vtbl;
surface->IDirectDrawSurface4_iface.lpVtbl = &ddraw_surface4_vtbl;
surface->IDirectDrawSurface3_iface.lpVtbl = &ddraw_surface3_vtbl;
surface->IDirectDrawSurface2_iface.lpVtbl = &ddraw_surface2_vtbl;
surface->IDirectDrawSurface_iface.lpVtbl = &ddraw_surface1_vtbl;
surface->IDirectDrawGammaControl_iface.lpVtbl = &ddraw_gamma_control_vtbl;
surface->IDirect3DTexture2_iface.lpVtbl = &d3d_texture2_vtbl;
surface->IDirect3DTexture_iface.lpVtbl = &d3d_texture1_vtbl;
surface->iface_count = 1;
surface->version = version;
surface->ddraw = ddraw;
if (version == 7)
{
surface->ref7 = 1;
surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface7_iface;
}
else if (version == 4)
{
surface->ref4 = 1;
surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface4_iface;
}
else
{
surface->ref1 = 1;
surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface_iface;
}
surface->first_attached = surface;
wined3d_texture_incref(surface->wined3d_texture = wined3d_texture);
surface->sub_resource_idx = sub_resource_idx;
surface->texture_location = DDRAW_SURFACE_LOCATION_DEFAULT;
wined3d_private_store_init(&surface->private_store);
}
static void STDMETHODCALLTYPE ddraw_texture_wined3d_object_destroyed(void *parent) static void STDMETHODCALLTYPE ddraw_texture_wined3d_object_destroyed(void *parent)
{ {
struct ddraw_texture *texture = parent; struct ddraw_texture *texture = parent;
@ -6836,49 +6879,6 @@ fail:
return hr; return hr;
} }
void ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw,
struct wined3d_texture *wined3d_texture, unsigned int sub_resource_idx)
{
struct ddraw_texture *texture = wined3d_texture_get_parent(wined3d_texture);
unsigned int version = texture->version;
surface->IDirectDrawSurface7_iface.lpVtbl = &ddraw_surface7_vtbl;
surface->IDirectDrawSurface4_iface.lpVtbl = &ddraw_surface4_vtbl;
surface->IDirectDrawSurface3_iface.lpVtbl = &ddraw_surface3_vtbl;
surface->IDirectDrawSurface2_iface.lpVtbl = &ddraw_surface2_vtbl;
surface->IDirectDrawSurface_iface.lpVtbl = &ddraw_surface1_vtbl;
surface->IDirectDrawGammaControl_iface.lpVtbl = &ddraw_gamma_control_vtbl;
surface->IDirect3DTexture2_iface.lpVtbl = &d3d_texture2_vtbl;
surface->IDirect3DTexture_iface.lpVtbl = &d3d_texture1_vtbl;
surface->iface_count = 1;
surface->version = version;
surface->ddraw = ddraw;
if (version == 7)
{
surface->ref7 = 1;
surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface7_iface;
}
else if (version == 4)
{
surface->ref4 = 1;
surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface4_iface;
}
else
{
surface->ref1 = 1;
surface->texture_outer = (IUnknown *)&surface->IDirectDrawSurface_iface;
}
surface->first_attached = surface;
wined3d_texture_incref(surface->wined3d_texture = wined3d_texture);
surface->sub_resource_idx = sub_resource_idx;
surface->texture_location = DDRAW_SURFACE_LOCATION_DEFAULT;
wined3d_private_store_init(&surface->private_store);
}
static void STDMETHODCALLTYPE view_wined3d_object_destroyed(void *parent) static void STDMETHODCALLTYPE view_wined3d_object_destroyed(void *parent)
{ {
struct ddraw_surface *surface = parent; struct ddraw_surface *surface = parent;