diff options
author | José Fonseca <jfonseca@vmware.com> | 2014-09-24 14:44:09 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2014-09-24 16:28:44 +0100 |
commit | 837a62c581254345ad97276386757f775a5872bb (patch) | |
tree | 1a78e051cd476da6d3c313ec21e708a267b9669a /retrace/d3dretrace_dxgi_priv.cpp | |
parent | b00229e63ba6f22805b8aee2068a64a05e6eea9b (diff) |
d3dretrace: Fix implementation of IDXGISwapChainDWM::GetContainingOutput.
Diffstat (limited to 'retrace/d3dretrace_dxgi_priv.cpp')
-rw-r--r-- | retrace/d3dretrace_dxgi_priv.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/retrace/d3dretrace_dxgi_priv.cpp b/retrace/d3dretrace_dxgi_priv.cpp index d8b30b6c..2b12b7ae 100644 --- a/retrace/d3dretrace_dxgi_priv.cpp +++ b/retrace/d3dretrace_dxgi_priv.cpp @@ -61,15 +61,23 @@ class CDXGISwapChainDWM : public IDXGISwapChainDWM { protected: IDXGISwapChain *m_pSwapChain; + IDXGIOutput *m_pOutput; ~CDXGISwapChainDWM() { m_pSwapChain->SetFullscreenState(FALSE, NULL); + m_pOutput->Release(); } public: - CDXGISwapChainDWM(IDXGISwapChain *pSwapChain) : - m_pSwapChain(pSwapChain) - {} + CDXGISwapChainDWM(IDXGISwapChain *pSwapChain, IDXGIOutput *pOutput) : + m_pSwapChain(pSwapChain), + m_pOutput(pOutput) + { + m_pOutput->AddRef(); + if (!retrace::forceWindowed) { + pSwapChain->SetFullscreenState(TRUE, pOutput); + } + } /* * IUnknown @@ -167,7 +175,7 @@ public: HRESULT STDMETHODCALLTYPE GetContainingOutput(IDXGIOutput **ppOutput) { - return m_pSwapChain->GetContainingOutput(ppOutput); + return GetInterface(m_pOutput, (void **) ppOutput); } HRESULT STDMETHODCALLTYPE @@ -229,6 +237,7 @@ public: HRESULT STDMETHODCALLTYPE CreateSwapChain(IUnknown *pDevice, DXGI_SWAP_CHAIN_DESC *pDesc, IDXGIOutput *pOutput, IDXGISwapChainDWM **ppSwapChain) { + assert(pOutput); IDXGISwapChain *pSwapChain = NULL; if (retrace::forceWindowed) { assert(pDesc->Windowed); @@ -237,10 +246,7 @@ public: pDesc->OutputWindow = d3dretrace::createWindow(pDesc->BufferDesc.Width, pDesc->BufferDesc.Height); HRESULT hr = m_pFactory->CreateSwapChain(pDevice, pDesc, &pSwapChain); if (SUCCEEDED(hr)) { - if (!retrace::forceWindowed) { - pSwapChain->SetFullscreenState(TRUE, pOutput); - } - *ppSwapChain = new CDXGISwapChainDWM(pSwapChain); + *ppSwapChain = new CDXGISwapChainDWM(pSwapChain, pOutput); } return hr; } |