d3drm: Consolidate GetClassName() implementation, reduce tests duplication.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
292f8266b9
commit
12967d88e5
|
@ -39,11 +39,12 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void d3drm_object_init(struct d3drm_object *object)
|
void d3drm_object_init(struct d3drm_object *object, const char *classname)
|
||||||
{
|
{
|
||||||
object->ref = 1;
|
object->ref = 1;
|
||||||
object->appdata = 0;
|
object->appdata = 0;
|
||||||
list_init(&object->destroy_callbacks);
|
list_init(&object->destroy_callbacks);
|
||||||
|
object->classname = classname;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct destroy_callback
|
struct destroy_callback
|
||||||
|
@ -91,6 +92,25 @@ HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMO
|
||||||
return D3DRM_OK;
|
return D3DRM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT d3drm_object_get_class_name(struct d3drm_object *object, DWORD *size, char *name)
|
||||||
|
{
|
||||||
|
DWORD req_size;
|
||||||
|
|
||||||
|
if (!size)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
req_size = strlen(object->classname) + 1;
|
||||||
|
if (name && *size < req_size)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
*size = req_size;
|
||||||
|
|
||||||
|
if (name)
|
||||||
|
memcpy(name, object->classname, req_size);
|
||||||
|
|
||||||
|
return D3DRM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object)
|
void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object)
|
||||||
{
|
{
|
||||||
struct destroy_callback *callback, *callback2;
|
struct destroy_callback *callback, *callback2;
|
||||||
|
|
|
@ -41,6 +41,7 @@ struct d3drm_object
|
||||||
LONG ref;
|
LONG ref;
|
||||||
DWORD appdata;
|
DWORD appdata;
|
||||||
struct list destroy_callbacks;
|
struct list destroy_callbacks;
|
||||||
|
const char *classname;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct d3drm_texture
|
struct d3drm_texture
|
||||||
|
@ -56,6 +57,7 @@ struct d3drm_texture
|
||||||
|
|
||||||
struct d3drm_frame
|
struct d3drm_frame
|
||||||
{
|
{
|
||||||
|
struct d3drm_object obj;
|
||||||
IDirect3DRMFrame IDirect3DRMFrame_iface;
|
IDirect3DRMFrame IDirect3DRMFrame_iface;
|
||||||
IDirect3DRMFrame2 IDirect3DRMFrame2_iface;
|
IDirect3DRMFrame2 IDirect3DRMFrame2_iface;
|
||||||
IDirect3DRMFrame3 IDirect3DRMFrame3_iface;
|
IDirect3DRMFrame3 IDirect3DRMFrame3_iface;
|
||||||
|
@ -117,9 +119,10 @@ void d3drm_device_destroy(struct d3drm_device *device) DECLSPEC_HIDDEN;
|
||||||
HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw *ddraw,
|
HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw *ddraw,
|
||||||
IDirectDrawSurface *surface, BOOL create_z_surface) DECLSPEC_HIDDEN;
|
IDirectDrawSurface *surface, BOOL create_z_surface) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
void d3drm_object_init(struct d3drm_object *object) DECLSPEC_HIDDEN;
|
void d3drm_object_init(struct d3drm_object *object, const char *classname) DECLSPEC_HIDDEN;
|
||||||
HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
|
HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
|
||||||
HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
|
HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
|
||||||
|
HRESULT d3drm_object_get_class_name(struct d3drm_object *object, DWORD *size, char *name) DECLSPEC_HIDDEN;
|
||||||
void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object) DECLSPEC_HIDDEN;
|
void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface) DECLSPEC_HIDDEN;
|
struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -554,15 +554,11 @@ static HRESULT WINAPI d3drm_device1_GetName(IDirect3DRMDevice *iface, DWORD *siz
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_device3_GetClassName(IDirect3DRMDevice3 *iface, DWORD *size, char *name)
|
static HRESULT WINAPI d3drm_device3_GetClassName(IDirect3DRMDevice3 *iface, DWORD *size, char *name)
|
||||||
{
|
{
|
||||||
|
struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
|
||||||
|
|
||||||
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
||||||
|
|
||||||
if (!size || *size < strlen("Device") || !name)
|
return d3drm_object_get_class_name(&device->obj, size, name);
|
||||||
return E_INVALIDARG;
|
|
||||||
|
|
||||||
strcpy(name, "Device");
|
|
||||||
*size = sizeof("Device");
|
|
||||||
|
|
||||||
return D3DRM_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_device2_GetClassName(IDirect3DRMDevice2 *iface, DWORD *size, char *name)
|
static HRESULT WINAPI d3drm_device2_GetClassName(IDirect3DRMDevice2 *iface, DWORD *size, char *name)
|
||||||
|
@ -1630,6 +1626,7 @@ struct d3drm_device *unsafe_impl_from_IDirect3DRMDevice3(IDirect3DRMDevice3 *ifa
|
||||||
|
|
||||||
HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm)
|
HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm)
|
||||||
{
|
{
|
||||||
|
static const char classname[] = "Device";
|
||||||
struct d3drm_device *object;
|
struct d3drm_device *object;
|
||||||
|
|
||||||
TRACE("device %p, d3drm %p.\n", device, d3drm);
|
TRACE("device %p, d3drm %p.\n", device, d3drm);
|
||||||
|
@ -1642,7 +1639,7 @@ HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm)
|
||||||
object->IDirect3DRMDevice3_iface.lpVtbl = &d3drm_device3_vtbl;
|
object->IDirect3DRMDevice3_iface.lpVtbl = &d3drm_device3_vtbl;
|
||||||
object->IDirect3DRMWinDevice_iface.lpVtbl = &d3drm_device_win_vtbl;
|
object->IDirect3DRMWinDevice_iface.lpVtbl = &d3drm_device_win_vtbl;
|
||||||
object->d3drm = d3drm;
|
object->d3drm = d3drm;
|
||||||
d3drm_object_init(&object->obj);
|
d3drm_object_init(&object->obj, classname);
|
||||||
|
|
||||||
*device = object;
|
*device = object;
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
|
||||||
|
|
||||||
struct d3drm_face
|
struct d3drm_face
|
||||||
{
|
{
|
||||||
|
struct d3drm_object obj;
|
||||||
IDirect3DRMFace IDirect3DRMFace_iface;
|
IDirect3DRMFace IDirect3DRMFace_iface;
|
||||||
IDirect3DRMFace2 IDirect3DRMFace2_iface;
|
IDirect3DRMFace2 IDirect3DRMFace2_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
@ -402,15 +403,11 @@ static HRESULT WINAPI d3drm_face2_GetName(IDirect3DRMFace2 *iface, DWORD *size,
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_face2_GetClassName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
|
static HRESULT WINAPI d3drm_face2_GetClassName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
|
||||||
{
|
{
|
||||||
|
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
|
||||||
|
|
||||||
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
||||||
|
|
||||||
if (!size || *size < strlen("Face") || !name)
|
return d3drm_object_get_class_name(&face->obj, size, name);
|
||||||
return E_INVALIDARG;
|
|
||||||
|
|
||||||
strcpy(name, "Face");
|
|
||||||
*size = sizeof("Face");
|
|
||||||
|
|
||||||
return D3DRM_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_face2_AddVertex(IDirect3DRMFace2 *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
|
static HRESULT WINAPI d3drm_face2_AddVertex(IDirect3DRMFace2 *iface, D3DVALUE x, D3DVALUE y, D3DVALUE z)
|
||||||
|
@ -588,6 +585,7 @@ static const struct IDirect3DRMFace2Vtbl d3drm_face2_vtbl =
|
||||||
|
|
||||||
HRESULT Direct3DRMFace_create(REFIID riid, IUnknown **out)
|
HRESULT Direct3DRMFace_create(REFIID riid, IUnknown **out)
|
||||||
{
|
{
|
||||||
|
static const char classname[] = "Face";
|
||||||
struct d3drm_face *object;
|
struct d3drm_face *object;
|
||||||
|
|
||||||
TRACE("riid %s, out %p.\n", debugstr_guid(riid), out);
|
TRACE("riid %s, out %p.\n", debugstr_guid(riid), out);
|
||||||
|
@ -599,6 +597,8 @@ HRESULT Direct3DRMFace_create(REFIID riid, IUnknown **out)
|
||||||
object->IDirect3DRMFace2_iface.lpVtbl = &d3drm_face2_vtbl;
|
object->IDirect3DRMFace2_iface.lpVtbl = &d3drm_face2_vtbl;
|
||||||
object->ref = 1;
|
object->ref = 1;
|
||||||
|
|
||||||
|
d3drm_object_init(&object->obj, classname);
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IDirect3DRMFace2))
|
if (IsEqualGUID(riid, &IID_IDirect3DRMFace2))
|
||||||
*out = (IUnknown*)&object->IDirect3DRMFace2_iface;
|
*out = (IUnknown*)&object->IDirect3DRMFace2_iface;
|
||||||
else
|
else
|
||||||
|
|
|
@ -730,15 +730,11 @@ static HRESULT WINAPI d3drm_frame1_GetName(IDirect3DRMFrame *iface, DWORD *size,
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_frame3_GetClassName(IDirect3DRMFrame3 *iface, DWORD *size, char *name)
|
static HRESULT WINAPI d3drm_frame3_GetClassName(IDirect3DRMFrame3 *iface, DWORD *size, char *name)
|
||||||
{
|
{
|
||||||
|
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
|
||||||
|
|
||||||
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
||||||
|
|
||||||
if (!size || *size < strlen("Frame") || !name)
|
return d3drm_object_get_class_name(&frame->obj, size, name);
|
||||||
return E_INVALIDARG;
|
|
||||||
|
|
||||||
strcpy(name, "Frame");
|
|
||||||
*size = sizeof("Frame");
|
|
||||||
|
|
||||||
return D3DRM_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_frame2_GetClassName(IDirect3DRMFrame2 *iface, DWORD *size, char *name)
|
static HRESULT WINAPI d3drm_frame2_GetClassName(IDirect3DRMFrame2 *iface, DWORD *size, char *name)
|
||||||
|
@ -2930,6 +2926,7 @@ struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface)
|
||||||
|
|
||||||
HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, IDirect3DRM *d3drm)
|
HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, IDirect3DRM *d3drm)
|
||||||
{
|
{
|
||||||
|
static const char classname[] = "Frame";
|
||||||
struct d3drm_frame *object;
|
struct d3drm_frame *object;
|
||||||
HRESULT hr = D3DRM_OK;
|
HRESULT hr = D3DRM_OK;
|
||||||
|
|
||||||
|
@ -2945,6 +2942,8 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I
|
||||||
object->ref = 1;
|
object->ref = 1;
|
||||||
d3drm_set_color(&object->scenebackground, 0.0f, 0.0f, 0.0f, 1.0f);
|
d3drm_set_color(&object->scenebackground, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
|
d3drm_object_init(&object->obj, classname);
|
||||||
|
|
||||||
memcpy(object->transform, identity, sizeof(D3DRMMATRIX4D));
|
memcpy(object->transform, identity, sizeof(D3DRMMATRIX4D));
|
||||||
|
|
||||||
if (parent_frame)
|
if (parent_frame)
|
||||||
|
|
|
@ -27,6 +27,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3drm);
|
||||||
|
|
||||||
struct d3drm_light
|
struct d3drm_light
|
||||||
{
|
{
|
||||||
|
struct d3drm_object obj;
|
||||||
IDirect3DRMLight IDirect3DRMLight_iface;
|
IDirect3DRMLight IDirect3DRMLight_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
D3DRMLIGHTTYPE type;
|
D3DRMLIGHTTYPE type;
|
||||||
|
@ -139,15 +140,11 @@ static HRESULT WINAPI d3drm_light_GetName(IDirect3DRMLight *iface, DWORD *size,
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_light_GetClassName(IDirect3DRMLight *iface, DWORD *size, char *name)
|
static HRESULT WINAPI d3drm_light_GetClassName(IDirect3DRMLight *iface, DWORD *size, char *name)
|
||||||
{
|
{
|
||||||
|
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
|
||||||
|
|
||||||
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
||||||
|
|
||||||
if (!size || *size < strlen("Light") || !name)
|
return d3drm_object_get_class_name(&light->obj, size, name);
|
||||||
return E_INVALIDARG;
|
|
||||||
|
|
||||||
strcpy(name, "Light");
|
|
||||||
*size = sizeof("Light");
|
|
||||||
|
|
||||||
return D3DRM_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_light_SetType(IDirect3DRMLight *iface, D3DRMLIGHTTYPE type)
|
static HRESULT WINAPI d3drm_light_SetType(IDirect3DRMLight *iface, D3DRMLIGHTTYPE type)
|
||||||
|
@ -372,6 +369,7 @@ static const struct IDirect3DRMLightVtbl d3drm_light_vtbl =
|
||||||
|
|
||||||
HRESULT Direct3DRMLight_create(IUnknown **out)
|
HRESULT Direct3DRMLight_create(IUnknown **out)
|
||||||
{
|
{
|
||||||
|
static const char classname[] = "Light";
|
||||||
struct d3drm_light *object;
|
struct d3drm_light *object;
|
||||||
|
|
||||||
TRACE("out %p.\n", out);
|
TRACE("out %p.\n", out);
|
||||||
|
@ -382,6 +380,8 @@ HRESULT Direct3DRMLight_create(IUnknown **out)
|
||||||
object->IDirect3DRMLight_iface.lpVtbl = &d3drm_light_vtbl;
|
object->IDirect3DRMLight_iface.lpVtbl = &d3drm_light_vtbl;
|
||||||
object->ref = 1;
|
object->ref = 1;
|
||||||
|
|
||||||
|
d3drm_object_init(&object->obj, classname);
|
||||||
|
|
||||||
*out = (IUnknown *)&object->IDirect3DRMLight_iface;
|
*out = (IUnknown *)&object->IDirect3DRMLight_iface;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -34,6 +34,7 @@ struct color_rgb
|
||||||
|
|
||||||
struct d3drm_material
|
struct d3drm_material
|
||||||
{
|
{
|
||||||
|
struct d3drm_object obj;
|
||||||
IDirect3DRMMaterial2 IDirect3DRMMaterial2_iface;
|
IDirect3DRMMaterial2 IDirect3DRMMaterial2_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
struct color_rgb emissive;
|
struct color_rgb emissive;
|
||||||
|
@ -143,15 +144,11 @@ static HRESULT WINAPI d3drm_material_GetName(IDirect3DRMMaterial2 *iface, DWORD
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_material_GetClassName(IDirect3DRMMaterial2 *iface, DWORD *size, char *name)
|
static HRESULT WINAPI d3drm_material_GetClassName(IDirect3DRMMaterial2 *iface, DWORD *size, char *name)
|
||||||
{
|
{
|
||||||
|
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
|
||||||
|
|
||||||
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
||||||
|
|
||||||
if (!size || *size < strlen("Material") || !name)
|
return d3drm_object_get_class_name(&material->obj, size, name);
|
||||||
return E_INVALIDARG;
|
|
||||||
|
|
||||||
strcpy(name, "Material");
|
|
||||||
*size = sizeof("Material");
|
|
||||||
|
|
||||||
return D3DRM_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_material_SetPower(IDirect3DRMMaterial2 *iface, D3DVALUE power)
|
static HRESULT WINAPI d3drm_material_SetPower(IDirect3DRMMaterial2 *iface, D3DVALUE power)
|
||||||
|
@ -283,6 +280,7 @@ static const struct IDirect3DRMMaterial2Vtbl d3drm_material_vtbl =
|
||||||
|
|
||||||
HRESULT Direct3DRMMaterial_create(IDirect3DRMMaterial2 **out)
|
HRESULT Direct3DRMMaterial_create(IDirect3DRMMaterial2 **out)
|
||||||
{
|
{
|
||||||
|
static const char classname[] = "Material";
|
||||||
struct d3drm_material *object;
|
struct d3drm_material *object;
|
||||||
|
|
||||||
TRACE("out %p.\n", out);
|
TRACE("out %p.\n", out);
|
||||||
|
@ -297,6 +295,8 @@ HRESULT Direct3DRMMaterial_create(IDirect3DRMMaterial2 **out)
|
||||||
object->specular.g = 1.0f;
|
object->specular.g = 1.0f;
|
||||||
object->specular.b = 1.0f;
|
object->specular.b = 1.0f;
|
||||||
|
|
||||||
|
d3drm_object_init(&object->obj, classname);
|
||||||
|
|
||||||
*out = &object->IDirect3DRMMaterial2_iface;
|
*out = &object->IDirect3DRMMaterial2_iface;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -41,6 +41,7 @@ struct mesh_group
|
||||||
|
|
||||||
struct d3drm_mesh
|
struct d3drm_mesh
|
||||||
{
|
{
|
||||||
|
struct d3drm_object obj;
|
||||||
IDirect3DRMMesh IDirect3DRMMesh_iface;
|
IDirect3DRMMesh IDirect3DRMMesh_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
DWORD groups_capacity;
|
DWORD groups_capacity;
|
||||||
|
@ -63,6 +64,7 @@ struct mesh_material
|
||||||
|
|
||||||
struct d3drm_mesh_builder
|
struct d3drm_mesh_builder
|
||||||
{
|
{
|
||||||
|
struct d3drm_object obj;
|
||||||
IDirect3DRMMeshBuilder2 IDirect3DRMMeshBuilder2_iface;
|
IDirect3DRMMeshBuilder2 IDirect3DRMMeshBuilder2_iface;
|
||||||
IDirect3DRMMeshBuilder3 IDirect3DRMMeshBuilder3_iface;
|
IDirect3DRMMeshBuilder3 IDirect3DRMMeshBuilder3_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
@ -1017,15 +1019,11 @@ static HRESULT WINAPI d3drm_mesh_builder3_GetName(IDirect3DRMMeshBuilder3 *iface
|
||||||
static HRESULT WINAPI d3drm_mesh_builder3_GetClassName(IDirect3DRMMeshBuilder3 *iface,
|
static HRESULT WINAPI d3drm_mesh_builder3_GetClassName(IDirect3DRMMeshBuilder3 *iface,
|
||||||
DWORD *size, char *name)
|
DWORD *size, char *name)
|
||||||
{
|
{
|
||||||
|
struct d3drm_mesh_builder *meshbuilder = impl_from_IDirect3DRMMeshBuilder3(iface);
|
||||||
|
|
||||||
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
||||||
|
|
||||||
if (!size || *size < strlen("Builder") || !name)
|
return d3drm_object_get_class_name(&meshbuilder->obj, size, name);
|
||||||
return E_INVALIDARG;
|
|
||||||
|
|
||||||
strcpy(name, "Builder");
|
|
||||||
*size = sizeof("Builder");
|
|
||||||
|
|
||||||
return D3DRM_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
|
HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
|
||||||
|
@ -2300,6 +2298,7 @@ static const struct IDirect3DRMMeshBuilder3Vtbl d3drm_mesh_builder3_vtbl =
|
||||||
|
|
||||||
HRESULT Direct3DRMMeshBuilder_create(REFIID riid, IUnknown **out)
|
HRESULT Direct3DRMMeshBuilder_create(REFIID riid, IUnknown **out)
|
||||||
{
|
{
|
||||||
|
static const char classname[] = "Builder";
|
||||||
struct d3drm_mesh_builder *object;
|
struct d3drm_mesh_builder *object;
|
||||||
|
|
||||||
TRACE("riid %s, out %p.\n", debugstr_guid(riid), out);
|
TRACE("riid %s, out %p.\n", debugstr_guid(riid), out);
|
||||||
|
@ -2311,6 +2310,8 @@ HRESULT Direct3DRMMeshBuilder_create(REFIID riid, IUnknown **out)
|
||||||
object->IDirect3DRMMeshBuilder3_iface.lpVtbl = &d3drm_mesh_builder3_vtbl;
|
object->IDirect3DRMMeshBuilder3_iface.lpVtbl = &d3drm_mesh_builder3_vtbl;
|
||||||
object->ref = 1;
|
object->ref = 1;
|
||||||
|
|
||||||
|
d3drm_object_init(&object->obj, classname);
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder3))
|
if (IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder3))
|
||||||
*out = (IUnknown *)&object->IDirect3DRMMeshBuilder3_iface;
|
*out = (IUnknown *)&object->IDirect3DRMMeshBuilder3_iface;
|
||||||
else
|
else
|
||||||
|
@ -2430,15 +2431,11 @@ static HRESULT WINAPI d3drm_mesh_GetName(IDirect3DRMMesh *iface, DWORD *size, ch
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_mesh_GetClassName(IDirect3DRMMesh *iface, DWORD *size, char *name)
|
static HRESULT WINAPI d3drm_mesh_GetClassName(IDirect3DRMMesh *iface, DWORD *size, char *name)
|
||||||
{
|
{
|
||||||
|
struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface);
|
||||||
|
|
||||||
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
||||||
|
|
||||||
if (!size || *size < strlen("Mesh") || !name)
|
return d3drm_object_get_class_name(&mesh->obj, size, name);
|
||||||
return E_INVALIDARG;
|
|
||||||
|
|
||||||
strcpy(name, "Mesh");
|
|
||||||
*size = sizeof("Mesh");
|
|
||||||
|
|
||||||
return D3DRM_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_mesh_Scale(IDirect3DRMMesh *iface,
|
static HRESULT WINAPI d3drm_mesh_Scale(IDirect3DRMMesh *iface,
|
||||||
|
@ -2808,6 +2805,7 @@ static const struct IDirect3DRMMeshVtbl d3drm_mesh_vtbl =
|
||||||
|
|
||||||
HRESULT Direct3DRMMesh_create(IDirect3DRMMesh **mesh)
|
HRESULT Direct3DRMMesh_create(IDirect3DRMMesh **mesh)
|
||||||
{
|
{
|
||||||
|
static const char classname[] = "Mesh";
|
||||||
struct d3drm_mesh *object;
|
struct d3drm_mesh *object;
|
||||||
|
|
||||||
TRACE("mesh %p.\n", mesh);
|
TRACE("mesh %p.\n", mesh);
|
||||||
|
@ -2818,6 +2816,8 @@ HRESULT Direct3DRMMesh_create(IDirect3DRMMesh **mesh)
|
||||||
object->IDirect3DRMMesh_iface.lpVtbl = &d3drm_mesh_vtbl;
|
object->IDirect3DRMMesh_iface.lpVtbl = &d3drm_mesh_vtbl;
|
||||||
object->ref = 1;
|
object->ref = 1;
|
||||||
|
|
||||||
|
d3drm_object_init(&object->obj, classname);
|
||||||
|
|
||||||
*mesh = &object->IDirect3DRMMesh_iface;
|
*mesh = &object->IDirect3DRMMesh_iface;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -52,6 +52,48 @@ static D3DRMMATRIX4D identity = {
|
||||||
{ 0.0f, 0.0f, 0.0f, 1.0f }
|
{ 0.0f, 0.0f, 0.0f, 1.0f }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define test_class_name(a, b) test_class_name_(__LINE__, a, b)
|
||||||
|
static void test_class_name_(unsigned int line, IDirect3DRMObject *object, const char *name)
|
||||||
|
{
|
||||||
|
char cname[64] = {0};
|
||||||
|
HRESULT hr;
|
||||||
|
DWORD size;
|
||||||
|
|
||||||
|
hr = IDirect3DRMObject_GetClassName(object, NULL, cname);
|
||||||
|
ok_(__FILE__, line)(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirect3DRMViewport_GetClassName(object, NULL, NULL);
|
||||||
|
ok_(__FILE__, line)(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
size = 0;
|
||||||
|
hr = IDirect3DRMObject_GetClassName(object, &size, NULL);
|
||||||
|
ok_(__FILE__, line)(hr == D3DRM_OK, "Failed to get classname size, hr %#x.\n", hr);
|
||||||
|
ok_(__FILE__, line)(size == strlen(name) + 1, "wrong size: %u\n", size);
|
||||||
|
|
||||||
|
size = 1;
|
||||||
|
hr = IDirect3DRMObject_GetClassName(object, &size, cname);
|
||||||
|
ok_(__FILE__, line)(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok_(__FILE__, line)(size == 1, "Got size %u.\n", size);
|
||||||
|
|
||||||
|
size = sizeof(cname);
|
||||||
|
hr = IDirect3DRMObject_GetClassName(object, &size, cname);
|
||||||
|
ok_(__FILE__, line)(hr == D3DRM_OK, "Failed to get classname, hr %#x.\n", hr);
|
||||||
|
ok_(__FILE__, line)(size == strlen(name) + 1, "wrong size: %u\n", size);
|
||||||
|
ok_(__FILE__, line)(!strcmp(cname, name), "Expected cname to be \"%s\", but got \"%s\".\n", name, cname);
|
||||||
|
|
||||||
|
size = strlen(name) + 1;
|
||||||
|
hr = IDirect3DRMObject_GetClassName(object, &size, cname);
|
||||||
|
ok_(__FILE__, line)(hr == D3DRM_OK, "Failed to get classname, hr %#x.\n", hr);
|
||||||
|
ok_(__FILE__, line)(size == strlen(name) + 1, "wrong size: %u\n", size);
|
||||||
|
ok_(__FILE__, line)(!strcmp(cname, name), "Expected cname to be \"%s\", but got \"%s\".\n", name, cname);
|
||||||
|
|
||||||
|
size = strlen(name);
|
||||||
|
strcpy(cname, "XXX");
|
||||||
|
hr = IDirect3DRMObject_GetClassName(object, &size, cname);
|
||||||
|
ok_(__FILE__, line)(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||||
|
ok_(__FILE__, line)(size == strlen(name), "Wrong classname size: %u.\n", size);
|
||||||
|
ok_(__FILE__, line)(!strcmp(cname, "XXX"), "Expected unchanged buffer, but got \"%s\".\n", cname);
|
||||||
|
}
|
||||||
|
|
||||||
static char data_bad_version[] =
|
static char data_bad_version[] =
|
||||||
"xof 0302txt 0064\n"
|
"xof 0302txt 0064\n"
|
||||||
"Header Object\n"
|
"Header Object\n"
|
||||||
|
@ -215,7 +257,6 @@ static void test_MeshBuilder(void)
|
||||||
char name[10];
|
char name[10];
|
||||||
DWORD size;
|
DWORD size;
|
||||||
D3DCOLOR color;
|
D3DCOLOR color;
|
||||||
CHAR cname[64] = {0};
|
|
||||||
IUnknown *unk;
|
IUnknown *unk;
|
||||||
|
|
||||||
hr = Direct3DRMCreate(&d3drm);
|
hr = Direct3DRMCreate(&d3drm);
|
||||||
|
@ -249,18 +290,7 @@ static void test_MeshBuilder(void)
|
||||||
|
|
||||||
IDirect3DRMMeshBuilder3_Release(meshbuilder3);
|
IDirect3DRMMeshBuilder3_Release(meshbuilder3);
|
||||||
|
|
||||||
hr = IDirect3DRMMeshBuilder_GetClassName(pMeshBuilder, NULL, cname);
|
test_class_name((IDirect3DRMObject *)pMeshBuilder, "Builder");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMMeshBuilder_GetClassName(pMeshBuilder, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = 1;
|
|
||||||
hr = IDirect3DRMMeshBuilder_GetClassName(pMeshBuilder, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = sizeof(cname);
|
|
||||||
hr = IDirect3DRMMeshBuilder_GetClassName(pMeshBuilder, &size, cname);
|
|
||||||
ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Builder"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Builder"), "Expected cname to be \"Builder\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
info.lpMemory = data_bad_version;
|
info.lpMemory = data_bad_version;
|
||||||
info.dSize = strlen(data_bad_version);
|
info.dSize = strlen(data_bad_version);
|
||||||
|
@ -534,8 +564,6 @@ static void test_MeshBuilder3(void)
|
||||||
int val;
|
int val;
|
||||||
DWORD val1;
|
DWORD val1;
|
||||||
D3DVALUE valu, valv;
|
D3DVALUE valu, valv;
|
||||||
DWORD size;
|
|
||||||
CHAR cname[64] = {0};
|
|
||||||
|
|
||||||
hr = Direct3DRMCreate(&d3drm);
|
hr = Direct3DRMCreate(&d3drm);
|
||||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr);
|
ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr);
|
||||||
|
@ -550,18 +578,7 @@ static void test_MeshBuilder3(void)
|
||||||
hr = IDirect3DRM3_CreateMeshBuilder(d3drm3, &pMeshBuilder3);
|
hr = IDirect3DRM3_CreateMeshBuilder(d3drm3, &pMeshBuilder3);
|
||||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMeshBuilder3 interface (hr = %x)\n", hr);
|
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMeshBuilder3 interface (hr = %x)\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DRMMeshBuilder3_GetClassName(pMeshBuilder3, NULL, cname);
|
test_class_name((IDirect3DRMObject *)pMeshBuilder3, "Builder");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMMeshBuilder3_GetClassName(pMeshBuilder3, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = 1;
|
|
||||||
hr = IDirect3DRMMeshBuilder3_GetClassName(pMeshBuilder3, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = sizeof(cname);
|
|
||||||
hr = IDirect3DRMMeshBuilder3_GetClassName(pMeshBuilder3, &size, cname);
|
|
||||||
ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Builder"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Builder"), "Expected cname to be \"Builder\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
info.lpMemory = data_bad_version;
|
info.lpMemory = data_bad_version;
|
||||||
info.dSize = strlen(data_bad_version);
|
info.dSize = strlen(data_bad_version);
|
||||||
|
@ -640,8 +657,6 @@ static void test_Mesh(void)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IDirect3DRM *d3drm;
|
IDirect3DRM *d3drm;
|
||||||
IDirect3DRMMesh *mesh;
|
IDirect3DRMMesh *mesh;
|
||||||
DWORD size;
|
|
||||||
CHAR cname[64] = {0};
|
|
||||||
IUnknown *unk;
|
IUnknown *unk;
|
||||||
|
|
||||||
hr = Direct3DRMCreate(&d3drm);
|
hr = Direct3DRMCreate(&d3drm);
|
||||||
|
@ -650,18 +665,7 @@ static void test_Mesh(void)
|
||||||
hr = IDirect3DRM_CreateMesh(d3drm, &mesh);
|
hr = IDirect3DRM_CreateMesh(d3drm, &mesh);
|
||||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMesh interface (hr = %x)\n", hr);
|
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMesh interface (hr = %x)\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DRMMesh_GetClassName(mesh, NULL, cname);
|
test_class_name((IDirect3DRMObject *)mesh, "Mesh");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMMesh_GetClassName(mesh, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = 1;
|
|
||||||
hr = IDirect3DRMMesh_GetClassName(mesh, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = sizeof(cname);
|
|
||||||
hr = IDirect3DRMMesh_GetClassName(mesh, &size, cname);
|
|
||||||
ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Mesh"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Mesh"), "Expected cname to be \"Mesh\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
hr = IDirect3DRMMesh_QueryInterface(mesh, &IID_IDirect3DRMObject, (void **)&unk);
|
hr = IDirect3DRMMesh_QueryInterface(mesh, &IID_IDirect3DRMObject, (void **)&unk);
|
||||||
ok(SUCCEEDED(hr), "Failed to get IDirect3DRMObject, %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get IDirect3DRMObject, %#x.\n", hr);
|
||||||
|
@ -690,7 +694,6 @@ static void test_Face(void)
|
||||||
D3DRMLOADMEMORY info;
|
D3DRMLOADMEMORY info;
|
||||||
D3DVECTOR v1[4], n1[4], v2[4], n2[4];
|
D3DVECTOR v1[4], n1[4], v2[4], n2[4];
|
||||||
DWORD count;
|
DWORD count;
|
||||||
CHAR cname[64] = {0};
|
|
||||||
int icount;
|
int icount;
|
||||||
|
|
||||||
hr = Direct3DRMCreate(&d3drm);
|
hr = Direct3DRMCreate(&d3drm);
|
||||||
|
@ -705,18 +708,7 @@ static void test_Face(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = IDirect3DRMFace_GetClassName(face1, NULL, cname);
|
test_class_name((IDirect3DRMObject *)face1, "Face");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMFace_GetClassName(face1, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
count = 1;
|
|
||||||
hr = IDirect3DRMFace_GetClassName(face1, &count, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
count = sizeof(cname);
|
|
||||||
hr = IDirect3DRMFace_GetClassName(face1, &count, cname);
|
|
||||||
ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(count == sizeof("Face"), "wrong size: %u\n", count);
|
|
||||||
ok(!strcmp(cname, "Face"), "Expected cname to be \"Face\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
icount = IDirect3DRMFace_GetVertexCount(face1);
|
icount = IDirect3DRMFace_GetVertexCount(face1);
|
||||||
ok(!icount, "wrong VertexCount: %i\n", icount);
|
ok(!icount, "wrong VertexCount: %i\n", icount);
|
||||||
|
@ -787,18 +779,7 @@ static void test_Face(void)
|
||||||
hr = IDirect3DRMMeshBuilder3_CreateFace(MeshBuilder3, &face2);
|
hr = IDirect3DRMMeshBuilder3_CreateFace(MeshBuilder3, &face2);
|
||||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMFace2 interface (hr = %x)\n", hr);
|
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMFace2 interface (hr = %x)\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DRMFace2_GetClassName(face2, NULL, cname);
|
test_class_name((IDirect3DRMObject *)face2, "Face");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMFace2_GetClassName(face2, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
count = 1;
|
|
||||||
hr = IDirect3DRMFace2_GetClassName(face2, &count, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
count = sizeof(cname);
|
|
||||||
hr = IDirect3DRMFace2_GetClassName(face2, &count, cname);
|
|
||||||
ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(count == sizeof("Face"), "wrong size: %u\n", count);
|
|
||||||
ok(!strcmp(cname, "Face"), "Expected cname to be \"Face\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
icount = IDirect3DRMMeshBuilder3_GetFaceCount(MeshBuilder3);
|
icount = IDirect3DRMMeshBuilder3_GetFaceCount(MeshBuilder3);
|
||||||
todo_wine
|
todo_wine
|
||||||
|
@ -932,7 +913,6 @@ static void test_Frame(void)
|
||||||
IDirect3DRMLightArray *light_array;
|
IDirect3DRMLightArray *light_array;
|
||||||
D3DCOLOR color;
|
D3DCOLOR color;
|
||||||
DWORD count;
|
DWORD count;
|
||||||
CHAR cname[64] = {0};
|
|
||||||
|
|
||||||
hr = Direct3DRMCreate(&d3drm);
|
hr = Direct3DRMCreate(&d3drm);
|
||||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr);
|
ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr);
|
||||||
|
@ -941,18 +921,7 @@ static void test_Frame(void)
|
||||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMFrame interface (hr = %x)\n", hr);
|
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMFrame interface (hr = %x)\n", hr);
|
||||||
CHECK_REFCOUNT(pFrameC, 1);
|
CHECK_REFCOUNT(pFrameC, 1);
|
||||||
|
|
||||||
hr = IDirect3DRMFrame_GetClassName(pFrameC, NULL, cname);
|
test_class_name((IDirect3DRMObject *)pFrameC, "Frame");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMFrame_GetClassName(pFrameC, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
count = 1;
|
|
||||||
hr = IDirect3DRMFrame_GetClassName(pFrameC, &count, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
count = sizeof(cname);
|
|
||||||
hr = IDirect3DRMFrame_GetClassName(pFrameC, &count, cname);
|
|
||||||
ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(count == sizeof("Frame"), "wrong size: %u\n", count);
|
|
||||||
ok(!strcmp(cname, "Frame"), "Expected cname to be \"Frame\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
hr = IDirect3DRMFrame_GetParent(pFrameC, NULL);
|
hr = IDirect3DRMFrame_GetParent(pFrameC, NULL);
|
||||||
ok(hr == D3DRMERR_BADVALUE, "Should fail and return D3DRM_BADVALUE (hr = %x)\n", hr);
|
ok(hr == D3DRMERR_BADVALUE, "Should fail and return D3DRM_BADVALUE (hr = %x)\n", hr);
|
||||||
|
@ -1541,9 +1510,8 @@ static void test_Viewport(void)
|
||||||
GUID driver;
|
GUID driver;
|
||||||
HWND window;
|
HWND window;
|
||||||
RECT rc;
|
RECT rc;
|
||||||
DWORD size, data, ref1, ref2, ref3, ref4;
|
DWORD data, ref1, ref2, ref3, ref4;
|
||||||
DWORD initial_ref1, initial_ref2, initial_ref3, device_ref, frame_ref, frame_ref2, viewport_ref;
|
DWORD initial_ref1, initial_ref2, initial_ref3, device_ref, frame_ref, frame_ref2, viewport_ref;
|
||||||
CHAR cname[64] = {0};
|
|
||||||
|
|
||||||
window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW, 0, 0, 300, 200, 0, 0, 0, 0);
|
window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW, 0, 0, 300, 200, 0, 0, 0, 0);
|
||||||
GetClientRect(window, &rc);
|
GetClientRect(window, &rc);
|
||||||
|
@ -1828,18 +1796,7 @@ static void test_Viewport(void)
|
||||||
IDirect3DRMObject_Release(obj);
|
IDirect3DRMObject_Release(obj);
|
||||||
IDirect3DRMObject_Release(obj2);
|
IDirect3DRMObject_Release(obj2);
|
||||||
|
|
||||||
hr = IDirect3DRMViewport_GetClassName(viewport, NULL, cname);
|
test_class_name((IDirect3DRMObject *)viewport, "Viewport");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMViewport_GetClassName(viewport, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = 1;
|
|
||||||
hr = IDirect3DRMViewport_GetClassName(viewport, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = sizeof(cname);
|
|
||||||
hr = IDirect3DRMViewport_GetClassName(viewport, &size, cname);
|
|
||||||
ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Viewport"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Viewport"), "Expected cname to be \"Viewport\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
/* AppData */
|
/* AppData */
|
||||||
hr = IDirect3DRMViewport_SetAppData(viewport, 0);
|
hr = IDirect3DRMViewport_SetAppData(viewport, 0);
|
||||||
|
@ -2091,8 +2048,6 @@ static void test_Light(void)
|
||||||
IDirect3DRMLight *light;
|
IDirect3DRMLight *light;
|
||||||
D3DRMLIGHTTYPE type;
|
D3DRMLIGHTTYPE type;
|
||||||
D3DCOLOR color;
|
D3DCOLOR color;
|
||||||
DWORD size;
|
|
||||||
CHAR cname[64] = {0};
|
|
||||||
|
|
||||||
hr = Direct3DRMCreate(&d3drm);
|
hr = Direct3DRMCreate(&d3drm);
|
||||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr);
|
ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr);
|
||||||
|
@ -2100,18 +2055,7 @@ static void test_Light(void)
|
||||||
hr = IDirect3DRM_CreateLightRGB(d3drm, D3DRMLIGHT_SPOT, 0.5, 0.5, 0.5, &light);
|
hr = IDirect3DRM_CreateLightRGB(d3drm, D3DRMLIGHT_SPOT, 0.5, 0.5, 0.5, &light);
|
||||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMLight interface (hr = %x)\n", hr);
|
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMLight interface (hr = %x)\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DRMLight_GetClassName(light, NULL, cname);
|
test_class_name((IDirect3DRMObject *)light, "Light");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMLight_GetClassName(light, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = 1;
|
|
||||||
hr = IDirect3DRMLight_GetClassName(light, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = sizeof(cname);
|
|
||||||
hr = IDirect3DRMLight_GetClassName(light, &size, cname);
|
|
||||||
ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Light"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Light"), "Expected cname to be \"Light\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
type = IDirect3DRMLight_GetType(light);
|
type = IDirect3DRMLight_GetType(light);
|
||||||
ok(type == D3DRMLIGHT_SPOT, "wrong type (%u)\n", type);
|
ok(type == D3DRMLIGHT_SPOT, "wrong type (%u)\n", type);
|
||||||
|
@ -2146,8 +2090,6 @@ static void test_Material2(void)
|
||||||
IDirect3DRM3 *d3drm3;
|
IDirect3DRM3 *d3drm3;
|
||||||
IDirect3DRMMaterial2 *material2;
|
IDirect3DRMMaterial2 *material2;
|
||||||
D3DVALUE r, g, b;
|
D3DVALUE r, g, b;
|
||||||
DWORD size;
|
|
||||||
CHAR cname[64] = {0};
|
|
||||||
|
|
||||||
hr = Direct3DRMCreate(&d3drm);
|
hr = Direct3DRMCreate(&d3drm);
|
||||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr);
|
ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr);
|
||||||
|
@ -2162,18 +2104,7 @@ static void test_Material2(void)
|
||||||
hr = IDirect3DRM3_CreateMaterial(d3drm3, 18.5f, &material2);
|
hr = IDirect3DRM3_CreateMaterial(d3drm3, 18.5f, &material2);
|
||||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMaterial2 interface (hr = %x)\n", hr);
|
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMaterial2 interface (hr = %x)\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DRMMaterial2_GetClassName(material2, NULL, cname);
|
test_class_name((IDirect3DRMObject *)material2, "Material");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMMaterial2_GetClassName(material2, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = 1;
|
|
||||||
hr = IDirect3DRMMaterial2_GetClassName(material2, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = sizeof(cname);
|
|
||||||
hr = IDirect3DRMMaterial2_GetClassName(material2, &size, cname);
|
|
||||||
ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Material"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Material"), "Expected cname to be \"Material\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
r = IDirect3DRMMaterial2_GetPower(material2);
|
r = IDirect3DRMMaterial2_GetPower(material2);
|
||||||
ok(r == 18.5f, "wrong power (%f)\n", r);
|
ok(r == 18.5f, "wrong power (%f)\n", r);
|
||||||
|
@ -2245,8 +2176,6 @@ static void test_Texture(void)
|
||||||
*d3drm_img = NULL;
|
*d3drm_img = NULL;
|
||||||
|
|
||||||
DWORD pixel[4] = { 20000, 30000, 10000, 0 };
|
DWORD pixel[4] = { 20000, 30000, 10000, 0 };
|
||||||
DWORD size;
|
|
||||||
CHAR cname[64] = {0};
|
|
||||||
ULONG ref1, ref2, ref3, ref4;
|
ULONG ref1, ref2, ref3, ref4;
|
||||||
|
|
||||||
hr = Direct3DRMCreate(&d3drm1);
|
hr = Direct3DRMCreate(&d3drm1);
|
||||||
|
@ -2385,55 +2314,14 @@ static void test_Texture(void)
|
||||||
ok(hr == D3DRMERR_NOTCREATEDFROMDDS, "GetSurface() expected to fail, %#x\n", hr);
|
ok(hr == D3DRMERR_NOTCREATEDFROMDDS, "GetSurface() expected to fail, %#x\n", hr);
|
||||||
|
|
||||||
/* Test all failures together */
|
/* Test all failures together */
|
||||||
hr = IDirect3DRMTexture_GetClassName(texture1, NULL, cname);
|
test_class_name((IDirect3DRMObject *)texture1, "Texture");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
test_class_name((IDirect3DRMObject *)texture2, "Texture");
|
||||||
hr = IDirect3DRMTexture_GetClassName(texture1, NULL, NULL);
|
test_class_name((IDirect3DRMObject *)texture3, "Texture");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMTexture2_GetClassName(texture2, NULL, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMTexture2_GetClassName(texture2, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMTexture3_GetClassName(texture3, NULL, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMTexture3_GetClassName(texture3, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = 1;
|
|
||||||
hr = IDirect3DRMTexture_GetClassName(texture1, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMTexture2_GetClassName(texture2, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMTexture3_GetClassName(texture3, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = sizeof("Texture") - 1;
|
|
||||||
strcpy(cname, "test");
|
|
||||||
hr = IDirect3DRMTexture_GetClassName(texture1, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
ok(size == sizeof("Texture") - 1, "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "test"), "Expected cname to be \"test\", but got \"%s\"\n", cname);
|
|
||||||
hr = IDirect3DRMTexture2_GetClassName(texture2, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
ok(size == sizeof("Texture") - 1, "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "test"), "Expected cname to be \"test\", but got \"%s\"\n", cname);
|
|
||||||
hr = IDirect3DRMTexture3_GetClassName(texture3, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
ok(size == sizeof("Texture") - 1, "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "test"), "Expected cname to be \"test\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
d3drm_img = IDirect3DRMTexture_GetImage(texture1);
|
d3drm_img = IDirect3DRMTexture_GetImage(texture1);
|
||||||
ok(!!d3drm_img, "Failed to get image.\n");
|
ok(!!d3drm_img, "Failed to get image.\n");
|
||||||
ok(d3drm_img == &initimg, "Expected image returned == %p, got %p.\n", &initimg, d3drm_img);
|
ok(d3drm_img == &initimg, "Expected image returned == %p, got %p.\n", &initimg, d3drm_img);
|
||||||
|
|
||||||
size = sizeof(cname);
|
|
||||||
hr = IDirect3DRMTexture_GetClassName(texture1, &size, cname);
|
|
||||||
ok(SUCCEEDED(hr), "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Texture"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Texture"), "Expected cname to be \"Texture\", but got \"%s\"\n", cname);
|
|
||||||
size = sizeof("Texture");
|
|
||||||
hr = IDirect3DRMTexture_GetClassName(texture1, &size, cname);
|
|
||||||
ok(SUCCEEDED(hr), "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Texture"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Texture"), "Expected cname to be \"Texture\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
IDirect3DRMTexture_Release(texture1);
|
IDirect3DRMTexture_Release(texture1);
|
||||||
ref2 = get_refcount((IUnknown *)d3drm1);
|
ref2 = get_refcount((IUnknown *)d3drm1);
|
||||||
ok(ref2 - 2 == ref1, "expected (ref2 - 2) == ref1, got ref1 = %u, ref2 = %u.\n", ref1, ref2);
|
ok(ref2 - 2 == ref1, "expected (ref2 - 2) == ref1, got ref1 = %u, ref2 = %u.\n", ref1, ref2);
|
||||||
|
@ -2447,17 +2335,6 @@ static void test_Texture(void)
|
||||||
ok(!!d3drm_img, "Failed to get image.\n");
|
ok(!!d3drm_img, "Failed to get image.\n");
|
||||||
ok(d3drm_img == &initimg, "Expected image returned == %p, got %p.\n", &initimg, d3drm_img);
|
ok(d3drm_img == &initimg, "Expected image returned == %p, got %p.\n", &initimg, d3drm_img);
|
||||||
|
|
||||||
size = sizeof(cname);
|
|
||||||
hr = IDirect3DRMTexture2_GetClassName(texture2, &size, cname);
|
|
||||||
ok(SUCCEEDED(hr), "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Texture"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Texture"), "Expected cname to be \"Texture\", but got \"%s\"\n", cname);
|
|
||||||
size = sizeof("Texture");
|
|
||||||
hr = IDirect3DRMTexture2_GetClassName(texture2, &size, cname);
|
|
||||||
ok(SUCCEEDED(hr), "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Texture"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Texture"), "Expected cname to be \"Texture\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
IDirect3DRMTexture2_Release(texture2);
|
IDirect3DRMTexture2_Release(texture2);
|
||||||
ref2 = get_refcount((IUnknown *)d3drm1);
|
ref2 = get_refcount((IUnknown *)d3drm1);
|
||||||
ok(ref2 - 1 == ref1, "expected (ref2 - 1) == ref1, got ref1 = %u, ref2 = %u.\n", ref1, ref2);
|
ok(ref2 - 1 == ref1, "expected (ref2 - 1) == ref1, got ref1 = %u, ref2 = %u.\n", ref1, ref2);
|
||||||
|
@ -2471,17 +2348,6 @@ static void test_Texture(void)
|
||||||
ok(!!d3drm_img, "Failed to get image.\n");
|
ok(!!d3drm_img, "Failed to get image.\n");
|
||||||
ok(d3drm_img == &initimg, "Expected image returned == %p, got %p.\n", &initimg, d3drm_img);
|
ok(d3drm_img == &initimg, "Expected image returned == %p, got %p.\n", &initimg, d3drm_img);
|
||||||
|
|
||||||
size = sizeof(cname);
|
|
||||||
hr = IDirect3DRMTexture3_GetClassName(texture3, &size, cname);
|
|
||||||
ok(SUCCEEDED(hr), "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Texture"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Texture"), "Expected cname to be \"Texture\", but got \"%s\"\n", cname);
|
|
||||||
size = sizeof("Texture");
|
|
||||||
hr = IDirect3DRMTexture3_GetClassName(texture3, &size, cname);
|
|
||||||
ok(SUCCEEDED(hr), "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Texture"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Texture"), "Expected cname to be \"Texture\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
IDirect3DRMTexture3_Release(texture3);
|
IDirect3DRMTexture3_Release(texture3);
|
||||||
ref2 = get_refcount((IUnknown *)d3drm1);
|
ref2 = get_refcount((IUnknown *)d3drm1);
|
||||||
ok(ref2 == ref1, "expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", ref1, ref2);
|
ok(ref2 == ref1, "expected ref2 == ref1, got ref1 = %u, ref2 = %u.\n", ref1, ref2);
|
||||||
|
@ -2639,8 +2505,6 @@ static void test_Device(void)
|
||||||
GUID driver;
|
GUID driver;
|
||||||
HWND window;
|
HWND window;
|
||||||
RECT rc;
|
RECT rc;
|
||||||
DWORD size;
|
|
||||||
CHAR cname[64] = {0};
|
|
||||||
|
|
||||||
window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW, 0, 0, 300, 200, 0, 0, 0, 0);
|
window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW, 0, 0, 300, 200, 0, 0, 0, 0);
|
||||||
GetClientRect(window, &rc);
|
GetClientRect(window, &rc);
|
||||||
|
@ -2658,18 +2522,7 @@ static void test_Device(void)
|
||||||
hr = IDirect3DRM3_CreateDeviceFromClipper(d3drm, pClipper, &driver, rc.right, rc.bottom, &device);
|
hr = IDirect3DRM3_CreateDeviceFromClipper(d3drm, pClipper, &driver, rc.right, rc.bottom, &device);
|
||||||
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMDevice interface (hr = %x)\n", hr);
|
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMDevice interface (hr = %x)\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DRMDevice_GetClassName(device, NULL, cname);
|
test_class_name((IDirect3DRMObject *)device, "Device");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMDevice_GetClassName(device, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = 1;
|
|
||||||
hr = IDirect3DRMDevice_GetClassName(device, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = sizeof(cname);
|
|
||||||
hr = IDirect3DRMDevice_GetClassName(device, &size, cname);
|
|
||||||
ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Device"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Device"), "Expected cname to be \"Device\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
/* WinDevice */
|
/* WinDevice */
|
||||||
if (FAILED(hr = IDirect3DRMDevice_QueryInterface(device, &IID_IDirect3DRMWinDevice, (void **)&win_device)))
|
if (FAILED(hr = IDirect3DRMDevice_QueryInterface(device, &IID_IDirect3DRMWinDevice, (void **)&win_device)))
|
||||||
|
@ -2678,19 +2531,7 @@ static void test_Device(void)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = IDirect3DRMWinDevice_GetClassName(win_device, NULL, cname);
|
test_class_name((IDirect3DRMObject *)win_device, "Device");
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
hr = IDirect3DRMWinDevice_GetClassName(win_device, NULL, NULL);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = 1;
|
|
||||||
hr = IDirect3DRMWinDevice_GetClassName(win_device, &size, cname);
|
|
||||||
ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr);
|
|
||||||
size = sizeof(cname);
|
|
||||||
hr = IDirect3DRMWinDevice_GetClassName(win_device, &size, cname);
|
|
||||||
ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr);
|
|
||||||
ok(size == sizeof("Device"), "wrong size: %u\n", size);
|
|
||||||
ok(!strcmp(cname, "Device"), "Expected cname to be \"Device\", but got \"%s\"\n", cname);
|
|
||||||
|
|
||||||
IDirect3DRMWinDevice_Release(win_device);
|
IDirect3DRMWinDevice_Release(win_device);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
|
@ -820,15 +820,11 @@ static HRESULT WINAPI d3drm_texture3_GetName(IDirect3DRMTexture3 *iface, DWORD *
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_texture3_GetClassName(IDirect3DRMTexture3 *iface, DWORD *size, char *name)
|
static HRESULT WINAPI d3drm_texture3_GetClassName(IDirect3DRMTexture3 *iface, DWORD *size, char *name)
|
||||||
{
|
{
|
||||||
|
struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
|
||||||
|
|
||||||
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
||||||
|
|
||||||
if (!size || *size < sizeof("Texture") || !name)
|
return d3drm_object_get_class_name(&texture->obj, size, name);
|
||||||
return E_INVALIDARG;
|
|
||||||
|
|
||||||
strcpy(name, "Texture");
|
|
||||||
*size = sizeof("Texture");
|
|
||||||
|
|
||||||
return D3DRM_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_texture3_InitFromFile(IDirect3DRMTexture3 *iface, const char *filename)
|
static HRESULT WINAPI d3drm_texture3_InitFromFile(IDirect3DRMTexture3 *iface, const char *filename)
|
||||||
|
@ -1114,6 +1110,7 @@ static const struct IDirect3DRMTexture3Vtbl d3drm_texture3_vtbl =
|
||||||
|
|
||||||
HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm)
|
HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm)
|
||||||
{
|
{
|
||||||
|
static const char classname[] = "Texture";
|
||||||
struct d3drm_texture *object;
|
struct d3drm_texture *object;
|
||||||
|
|
||||||
TRACE("texture %p.\n", texture);
|
TRACE("texture %p.\n", texture);
|
||||||
|
@ -1126,7 +1123,7 @@ HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm)
|
||||||
object->IDirect3DRMTexture3_iface.lpVtbl = &d3drm_texture3_vtbl;
|
object->IDirect3DRMTexture3_iface.lpVtbl = &d3drm_texture3_vtbl;
|
||||||
object->d3drm = d3drm;
|
object->d3drm = d3drm;
|
||||||
|
|
||||||
d3drm_object_init(&object->obj);
|
d3drm_object_init(&object->obj, classname);
|
||||||
|
|
||||||
*texture = object;
|
*texture = object;
|
||||||
|
|
||||||
|
|
|
@ -278,15 +278,11 @@ static HRESULT WINAPI d3drm_viewport1_GetName(IDirect3DRMViewport *iface, DWORD
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_viewport2_GetClassName(IDirect3DRMViewport2 *iface, DWORD *size, char *name)
|
static HRESULT WINAPI d3drm_viewport2_GetClassName(IDirect3DRMViewport2 *iface, DWORD *size, char *name)
|
||||||
{
|
{
|
||||||
|
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
|
||||||
|
|
||||||
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
|
||||||
|
|
||||||
if (!size || *size < strlen("Viewport") || !name)
|
return d3drm_object_get_class_name(&viewport->obj, size, name);
|
||||||
return E_INVALIDARG;
|
|
||||||
|
|
||||||
strcpy(name, "Viewport");
|
|
||||||
*size = sizeof("Viewport");
|
|
||||||
|
|
||||||
return D3DRM_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI d3drm_viewport1_GetClassName(IDirect3DRMViewport *iface, DWORD *size, char *name)
|
static HRESULT WINAPI d3drm_viewport1_GetClassName(IDirect3DRMViewport *iface, DWORD *size, char *name)
|
||||||
|
@ -1013,6 +1009,7 @@ static const struct IDirect3DRMViewportVtbl d3drm_viewport1_vtbl =
|
||||||
|
|
||||||
HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm)
|
HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3drm)
|
||||||
{
|
{
|
||||||
|
static const char classname[] = "Viewport";
|
||||||
struct d3drm_viewport *object;
|
struct d3drm_viewport *object;
|
||||||
|
|
||||||
TRACE("viewport %p, d3drm %p.\n", viewport, d3drm);
|
TRACE("viewport %p, d3drm %p.\n", viewport, d3drm);
|
||||||
|
@ -1023,7 +1020,7 @@ HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3d
|
||||||
object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl;
|
object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl;
|
||||||
object->IDirect3DRMViewport2_iface.lpVtbl = &d3drm_viewport2_vtbl;
|
object->IDirect3DRMViewport2_iface.lpVtbl = &d3drm_viewport2_vtbl;
|
||||||
object->d3drm = d3drm;
|
object->d3drm = d3drm;
|
||||||
d3drm_object_init(&object->obj);
|
d3drm_object_init(&object->obj, classname);
|
||||||
|
|
||||||
*viewport = object;
|
*viewport = object;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue