ddraw: Rename d3d_material_init() and have it allocate the object too.
This commit is contained in:
parent
abe0ee33eb
commit
db15ce6580
|
@ -4603,15 +4603,13 @@ static HRESULT WINAPI d3d3_CreateMaterial(IDirect3D3 *iface, IDirect3DMaterial3
|
||||||
|
|
||||||
if (outer_unknown) return CLASS_E_NOAGGREGATION;
|
if (outer_unknown) return CLASS_E_NOAGGREGATION;
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
object = d3d_material_create(This);
|
||||||
if (!object)
|
if (!object)
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate material memory.\n");
|
ERR("Failed to allocate material memory.\n");
|
||||||
return DDERR_OUTOFMEMORY;
|
return DDERR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
d3d_material_init(object, This);
|
|
||||||
|
|
||||||
TRACE("Created material %p.\n", object);
|
TRACE("Created material %p.\n", object);
|
||||||
*material = (IDirect3DMaterial3 *)object;
|
*material = (IDirect3DMaterial3 *)object;
|
||||||
|
|
||||||
|
|
|
@ -429,7 +429,7 @@ struct IDirect3DMaterialImpl
|
||||||
|
|
||||||
/* Helper functions */
|
/* Helper functions */
|
||||||
void material_activate(IDirect3DMaterialImpl* This) DECLSPEC_HIDDEN;
|
void material_activate(IDirect3DMaterialImpl* This) DECLSPEC_HIDDEN;
|
||||||
void d3d_material_init(IDirect3DMaterialImpl *material, IDirectDrawImpl *ddraw) DECLSPEC_HIDDEN;
|
IDirect3DMaterialImpl *d3d_material_create(IDirectDrawImpl *ddraw) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IDirect3DViewport - Wraps to D3D7
|
* IDirect3DViewport - Wraps to D3D7
|
||||||
|
|
|
@ -507,11 +507,19 @@ static const struct IDirect3DMaterialVtbl d3d_material1_vtbl =
|
||||||
IDirect3DMaterialImpl_Unreserve
|
IDirect3DMaterialImpl_Unreserve
|
||||||
};
|
};
|
||||||
|
|
||||||
void d3d_material_init(IDirect3DMaterialImpl *material, IDirectDrawImpl *ddraw)
|
IDirect3DMaterialImpl *d3d_material_create(IDirectDrawImpl *ddraw)
|
||||||
{
|
{
|
||||||
|
IDirect3DMaterialImpl *material;
|
||||||
|
|
||||||
|
material = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*material));
|
||||||
|
if (!material)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
material->lpVtbl = &d3d_material3_vtbl;
|
material->lpVtbl = &d3d_material3_vtbl;
|
||||||
material->IDirect3DMaterial2_iface.lpVtbl = &d3d_material2_vtbl;
|
material->IDirect3DMaterial2_iface.lpVtbl = &d3d_material2_vtbl;
|
||||||
material->IDirect3DMaterial_iface.lpVtbl = &d3d_material1_vtbl;
|
material->IDirect3DMaterial_iface.lpVtbl = &d3d_material1_vtbl;
|
||||||
material->ref = 1;
|
material->ref = 1;
|
||||||
material->ddraw = ddraw;
|
material->ddraw = ddraw;
|
||||||
|
|
||||||
|
return material;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue