[PATCH 1/2] d3drm: Implement IDirect3DRMFrame*::GetScene.

Stefan Dösinger stefandoesinger at gmail.com
Sat Aug 6 17:12:38 CDT 2016


On 2016-08-06 16:29, Aaryaman Vasishta wrote:
> +    while (!done)
> +    {
> +        if (FAILED(hr = IDirect3DRMFrame3_GetParent(frame, &parent_frame)))
> +            return hr;
> +        if (parent_frame)
> +        {
> +            frame = parent_frame;
> +            IDirect3DRMFrame3_Release(parent_frame);
> +        }
> +        else
> +            done = TRUE;
> +    }
What happens if GetScene is called on the root frame? Does it return itself or NULL or an error?

You can eliminate the done variable from this loop by replacing it with a break:

for (;;)
{
    if (FAILED(hr = IDirect3DRMFrame3_GetParent(frame, &parent_frame)))
        return hr;
    if (parent_frame)
    {
        frame = parent_frame;
        IDirect3DRMFrame3_Release(parent_frame);
    }
    else
        break;
}

I originally thought about a do {} while(parent_frame); kind of construct but that doesn't gain you much because you need the if check anyway to release parent_frame.

It's not nice to call GetParent in the next iteration after you release the frame, but so far I haven't come up with an implementation that avoids that and isn't terribly ugly. I'll keep thinking.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20160806/f0503cf9/attachment.sig>


More information about the wine-devel mailing list