[PATCH 1/7] d3drm: Use CreateObject in IDirect3DRM*::LoadTexture. (v3)

Henri Verbeet hverbeet at gmail.com
Fri May 20 04:09:50 CDT 2016


On 19 May 2016 at 13:00, Aaryaman Vasishta <jem456.vasishta at gmail.com> wrote:
>  static HRESULT WINAPI d3drm1_LoadTexture(IDirect3DRM *iface,
>          const char *filename, IDirect3DRMTexture **texture)
>  {
> -    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 = IDirect3DRM_CreateObject(iface, &CLSID_CDirect3DRMTexture, NULL,
> +            &IID_IDirect3DRMTexture, (void **)texture)))
>          return hr;
>
> -    *texture = &object->IDirect3DRMTexture_iface;
> -
>      return D3DRM_OK;
>  }
Actually, after thinking it through for a bit, I don't think you need
to use CreateObject() here at all. You can just add an extra parameter
to d3drm_texture_create() in patch 3/7 and avoid going through all the
COM stuff. (Of course at that point you'll also notice
load_mesh_data() is broken...)

> @@ -857,17 +855,19 @@ static HRESULT WINAPI d3drm2_CreateUserVisual(IDirect3DRM2 *iface,
>  static HRESULT WINAPI d3drm2_LoadTexture(IDirect3DRM2 *iface,
>          const char *filename, IDirect3DRMTexture2 **texture)
>  {
> -    struct d3drm_texture *object;
> +    struct d3drm *d3drm = impl_from_IDirect3DRM2(iface);
> +    IDirect3DRMTexture3 *texture3;
>      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 = IDirect3DRM3_LoadTexture(&d3drm->IDirect3DRM3_iface, filename, &texture3)))
>          return hr;
This change isn't necessarily wrong, but it's something different from
what the rest of the patch does.

Note that if things were ordered so that the newest version of the
interface came first, you could call d3drm3_LoadTexture() here
directly. The file is the way it is of course, but perhaps we should
consider fixing that at some point.



More information about the wine-devel mailing list