[2/3] d3d9: Partial implementation of IDirect3DSwapChain9Ex (try 2)

Henri Verbeet hverbeet at gmail.com
Mon Sep 2 04:37:20 CDT 2013


On 30 August 2013 17:09, Michael Müller <michael at fds-team.de> wrote:
> +static HRESULT WINAPI d3d9_swapchain_GetLastPresentCount(IDirect3DSwapChain9Ex *iface,
> +        UINT *pLastPresentCount)
> +{
> +    FIXME("iface %p, pLastPresentCount %p, stub!\n", iface, pLastPresentCount);
> +
> +    if(pLastPresentCount)
> +        *pLastPresentCount = 0;
> +
> +    return D3D_OK;
> +}
Please use the same style as the rest of the code. E.g., "if
(last_present_count)".

> +static HRESULT WINAPI d3d9_swapchain_GetDisplayModeEx(IDirect3DSwapChain9Ex *iface,
> +        D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation)
> +{
> +    struct d3d9_swapchain *swapchain = impl_from_IDirect3DSwapChain9Ex(iface);
> +    struct wined3d_display_mode wined3d_mode;
> +    enum wined3d_display_rotation wined3d_rotation;
> +    HRESULT hr;
> +
> +    TRACE("iface %p, pMode %p, pRotation %p.\n", iface, pMode, pRotation);
> +
> +    wined3d_mutex_lock();
> +    hr = wined3d_swapchain_get_display_mode(swapchain->wined3d_swapchain, &wined3d_mode, &wined3d_rotation);
> +    wined3d_mutex_unlock();
> +
> +    if (SUCCEEDED(hr))
> +    {
> +        if(pMode)
> +        {
> +            pMode->Size              = sizeof(D3DDISPLAYMODEEX);
> +            pMode->Width             = wined3d_mode.width;
> +            pMode->Height            = wined3d_mode.height;
> +            pMode->RefreshRate       = wined3d_mode.refresh_rate;
> +            pMode->Format            = d3dformat_from_wined3dformat(wined3d_mode.format_id);
> +            pMode->ScanLineOrdering  = wined3d_mode.scanline_ordering;
> +        }
> +
> +        if(pRotation)
> +            *pRotation               = wined3d_rotation;
> +
> +    }
> +
> +    return hr;
> +}
This is different from d3d9_GetAdapterDisplayModeEx(). The way you
handle "pMode->Size" looks suspicious, while the NULL checks on
"pMode" and "pRotation" may make sense. Please add tests to show this
is correct. (See also test_get_adapter_displaymode_ex(), although that
test has some room for improvement itself.)



More information about the wine-devel mailing list