Commit bebe679d authored by Aaryaman Vasishta's avatar Aaryaman Vasishta Committed by Alexandre Julliard

d3drm: Keep a reference to IDirect3DRM in d3drm_texture.

parent 54d8f57c
......@@ -200,7 +200,7 @@ static HRESULT WINAPI d3drm1_CreateTexture(IDirect3DRM *iface,
FIXME("iface %p, image %p, texture %p partial stub.\n", iface, image, texture);
if (FAILED(hr = d3drm_texture_create(&object)))
if (FAILED(hr = d3drm_texture_create(&object, iface)))
return hr;
*texture = &object->IDirect3DRMTexture_iface;
......@@ -418,7 +418,7 @@ static HRESULT WINAPI d3drm1_LoadTexture(IDirect3DRM *iface,
FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
if (FAILED(hr = d3drm_texture_create(&object)))
if (FAILED(hr = d3drm_texture_create(&object, iface)))
return hr;
*texture = &object->IDirect3DRMTexture_iface;
......@@ -434,7 +434,7 @@ static HRESULT WINAPI d3drm1_LoadTextureFromResource(IDirect3DRM *iface,
FIXME("iface %p, resource %p, texture %p stub!\n", iface, resource, texture);
if (FAILED(hr = d3drm_texture_create(&object)))
if (FAILED(hr = d3drm_texture_create(&object, iface)))
return hr;
*texture = &object->IDirect3DRMTexture_iface;
......@@ -661,12 +661,13 @@ static HRESULT WINAPI d3drm2_CreateAnimationSet(IDirect3DRM2 *iface, IDirect3DRM
static HRESULT WINAPI d3drm2_CreateTexture(IDirect3DRM2 *iface,
D3DRMIMAGE *image, IDirect3DRMTexture2 **texture)
{
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
struct d3drm_texture *object;
HRESULT hr;
FIXME("iface %p, image %p, texture %p partial stub.\n", iface, image, texture);
if (FAILED(hr = d3drm_texture_create(&object)))
if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface)))
return hr;
*texture = &object->IDirect3DRMTexture2_iface;
......@@ -857,29 +858,31 @@ static HRESULT WINAPI d3drm2_CreateUserVisual(IDirect3DRM2 *iface,
static HRESULT WINAPI d3drm2_LoadTexture(IDirect3DRM2 *iface,
const char *filename, IDirect3DRMTexture2 **texture)
{
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
struct d3drm_texture *object;
HRESULT hr;
FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
if (FAILED(hr = d3drm_texture_create(&object)))
if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface)))
return hr;
*texture = &object->IDirect3DRMTexture2_iface;
return D3DRM_OK;
return hr;
}
static HRESULT WINAPI d3drm2_LoadTextureFromResource(IDirect3DRM2 *iface, HMODULE module,
const char *resource_name, const char *resource_type, IDirect3DRMTexture2 **texture)
{
struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
struct d3drm_texture *object;
HRESULT hr;
FIXME("iface %p, resource_name %s, resource_type %s, texture %p stub!\n",
iface, debugstr_a(resource_name), debugstr_a(resource_type), texture);
if (FAILED(hr = d3drm_texture_create(&object)))
if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface)))
return hr;
*texture = &object->IDirect3DRMTexture2_iface;
......@@ -1058,6 +1061,7 @@ static ULONG WINAPI d3drm3_Release(IDirect3DRM3 *iface)
static HRESULT WINAPI d3drm3_CreateObject(IDirect3DRM3 *iface,
REFCLSID clsid, IUnknown *outer, REFIID iid, void **out)
{
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
IUnknown *object;
HRESULT hr;
......@@ -1083,7 +1087,7 @@ static HRESULT WINAPI d3drm3_CreateObject(IDirect3DRM3 *iface,
if (IsEqualGUID(clsid, &CLSID_CDirect3DRMTexture))
{
struct d3drm_texture *texture;
if (FAILED(hr = d3drm_texture_create(&texture)))
if (FAILED(hr = d3drm_texture_create(&texture, &d3drm->IDirect3DRM_iface)))
{
*out = NULL;
return hr;
......@@ -1150,12 +1154,13 @@ static HRESULT WINAPI d3drm3_CreateAnimationSet(IDirect3DRM3 *iface, IDirect3DRM
static HRESULT WINAPI d3drm3_CreateTexture(IDirect3DRM3 *iface,
D3DRMIMAGE *image, IDirect3DRMTexture3 **texture)
{
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
struct d3drm_texture *object;
HRESULT hr;
FIXME("iface %p, image %p, texture %p partial stub.\n", iface, image, texture);
if (FAILED(hr = d3drm_texture_create(&object)))
if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface)))
return hr;
*texture = &object->IDirect3DRMTexture3_iface;
......@@ -1396,12 +1401,13 @@ static HRESULT WINAPI d3drm3_CreateUserVisual(IDirect3DRM3 *iface,
static HRESULT WINAPI d3drm3_LoadTexture(IDirect3DRM3 *iface,
const char *filename, IDirect3DRMTexture3 **texture)
{
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
struct d3drm_texture *object;
HRESULT hr;
FIXME("iface %p, filename %s, texture %p stub!\n", iface, debugstr_a(filename), texture);
if (FAILED(hr = d3drm_texture_create(&object)))
if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface)))
return hr;
*texture = &object->IDirect3DRMTexture3_iface;
......@@ -1412,13 +1418,14 @@ static HRESULT WINAPI d3drm3_LoadTexture(IDirect3DRM3 *iface,
static HRESULT WINAPI d3drm3_LoadTextureFromResource(IDirect3DRM3 *iface, HMODULE module,
const char *resource_name, const char *resource_type, IDirect3DRMTexture3 **texture)
{
struct d3drm *d3drm = impl_from_IDirect3DRM3(iface);
struct d3drm_texture *object;
HRESULT hr;
FIXME("iface %p, module %p, resource_name %s, resource_type %s, texture %p stub!\n",
iface, module, debugstr_a(resource_name), debugstr_a(resource_type), texture);
if (FAILED(hr = d3drm_texture_create(&object)))
if (FAILED(hr = d3drm_texture_create(&object, &d3drm->IDirect3DRM_iface)))
return hr;
*texture = &object->IDirect3DRMTexture3_iface;
......
......@@ -40,6 +40,7 @@ struct d3drm_texture
IDirect3DRMTexture IDirect3DRMTexture_iface;
IDirect3DRMTexture2 IDirect3DRMTexture2_iface;
IDirect3DRMTexture3 IDirect3DRMTexture3_iface;
IDirect3DRM *d3drm;
};
void d3drm_object_init(struct d3drm_object *object) DECLSPEC_HIDDEN;
......@@ -48,7 +49,7 @@ HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMO
void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object) DECLSPEC_HIDDEN;
HRESULT d3drm_device_create(struct d3drm_device **out) DECLSPEC_HIDDEN;
HRESULT d3drm_texture_create(struct d3drm_texture **texture) DECLSPEC_HIDDEN;
HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm) DECLSPEC_HIDDEN;
IDirect3DRMDevice *IDirect3DRMDevice_from_impl(struct d3drm_device *device) DECLSPEC_HIDDEN;
IDirect3DRMDevice2 *IDirect3DRMDevice2_from_impl(struct d3drm_device *device) DECLSPEC_HIDDEN;
IDirect3DRMDevice3 *IDirect3DRMDevice3_from_impl(struct d3drm_device *device) DECLSPEC_HIDDEN;
......
......@@ -1300,7 +1300,7 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
if (file != INVALID_HANDLE_VALUE)
{
CloseHandle(file);
if (FAILED(hr = d3drm_texture_create(&texture_object)))
if (FAILED(hr = d3drm_texture_create(&texture_object, NULL)))
{
IDirectXFileData_Release(data);
goto end;
......
......@@ -1044,7 +1044,7 @@ static const struct IDirect3DRMTexture3Vtbl d3drm_texture3_vtbl =
d3drm_texture3_SetValidationCallback,
};
HRESULT d3drm_texture_create(struct d3drm_texture **texture)
HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm)
{
struct d3drm_texture *object;
......@@ -1056,6 +1056,7 @@ HRESULT d3drm_texture_create(struct d3drm_texture **texture)
object->IDirect3DRMTexture_iface.lpVtbl = &d3drm_texture1_vtbl;
object->IDirect3DRMTexture2_iface.lpVtbl = &d3drm_texture2_vtbl;
object->IDirect3DRMTexture3_iface.lpVtbl = &d3drm_texture3_vtbl;
object->d3drm = d3drm;
d3drm_object_init(&object->obj);
......
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