-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Am 2016-05-08 um 11:31 schrieb Aaryaman Vasishta:
- if (!d3drm_validate_image(image))
return D3DRMERR_BADVALUE;
Is this necessary? InitFromImage does it anyway I think.
if (FAILED(hr = d3drm_texture_create(&object))) return hr;
You could call the public CreateObject method here, but I don't have a strong opinion on this.
- object->d3drm = &d3drm->IDirect3DRM_iface;
Afaics InitFromImage does it anyway. It also causes problems when InitFromImage fails for some reason - you'll decref the d3drm object in the error path below.
- if (FAILED(hr = IDirect3DRMTexture3_InitFromImage(&object->IDirect3DRMTexture3_iface, image)))
- {
d3drm_texture_destroy(object);
return hr;
- }
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Am 2016-05-08 um 16:57 schrieb Stefan Dösinger:
- object->d3drm = &d3drm->IDirect3DRM_iface;
Afaics InitFromImage does it anyway. It also causes problems when InitFromImage fails for some reason - you'll decref the d3drm object in the error path below.
Er, I misread this part - InitFromImage doesn't assign texture->d3drm, and the decref is tied to having an image, not having d3drm set.
Still it seems to be duplicated logic to set this here.
On Sun, May 8, 2016 at 9:27 PM, Stefan Dösinger stefandoesinger@gmail.com wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Am 2016-05-08 um 11:31 schrieb Aaryaman Vasishta:
- if (!d3drm_validate_image(image))
return D3DRMERR_BADVALUE;
Is this necessary? InitFromImage does it anyway I think.
CreateTexture doesn't leak a reference to d3drm1 if the image is invalid. Although InitFromImage does. I could probably release d3drm1 on failure of InitFromImage instead of validating the image again like this.
if (FAILED(hr = d3drm_texture_create(&object))) return hr;
You could call the public CreateObject method here, but I don't have a strong opinion on this.
I just felt that it'd be better than going through multiple calls just to get to d3drm_texture_create. Though the difference in performance does seem neglibile. I'll use CreateObject if you want.
Cheers, Aaryaman