Commit 342ce213 authored by Ričardas Barkauskas's avatar Ričardas Barkauskas Committed by Alexandre Julliard

dxgi: Avoid division by zero.

Based on patch by Eduard - Gabriel Munteanu.
parent d9ce33bf
......@@ -161,6 +161,14 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetWindowAssociation(IWineDXGIFact
return E_NOTIMPL;
}
static UINT dxgi_rational_to_uint(const DXGI_RATIONAL *rational)
{
if (rational->Denominator)
return rational->Numerator / rational->Denominator;
else
return rational->Numerator;
}
static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *iface,
IUnknown *device, DXGI_SWAP_CHAIN_DESC *desc, IDXGISwapChain **swapchain)
{
......@@ -218,7 +226,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *
wined3d_desc.enable_auto_depth_stencil = FALSE;
wined3d_desc.auto_depth_stencil_format = 0;
wined3d_desc.flags = 0; /* WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL? */
wined3d_desc.refresh_rate = desc->BufferDesc.RefreshRate.Numerator / desc->BufferDesc.RefreshRate.Denominator;
wined3d_desc.refresh_rate = dxgi_rational_to_uint(&desc->BufferDesc.RefreshRate);
wined3d_desc.swap_interval = WINED3DPRESENT_INTERVAL_DEFAULT;
hr = wined3d_device_init_3d(wined3d_device, &wined3d_desc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment