[vlc-commits] [Git][videolan/vlc][master] qt: don't keep a reference to the IDCompositionTarget

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Jul 18 06:36:18 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
40bee9e7 by Steve Lhomme at 2024-07-18T05:59:00+00:00
qt: don't keep a reference to the IDCompositionTarget

We only need to set the root once.

- - - - -


2 changed files:

- modules/gui/qt/maininterface/compositor_dcomp.cpp
- modules/gui/qt/maininterface/compositor_dcomp.hpp


Changes:

=====================================
modules/gui/qt/maininterface/compositor_dcomp.cpp
=====================================
@@ -154,34 +154,37 @@ void CompositorDirectComposition::setup()
 
     assert(m_quickView->rhi()->backend() == QRhi::D3D11 || m_quickView->rhi()->backend() == QRhi::D3D12);
 
+    IDCompositionTarget* dcompTarget;
     if (rhi->backend() == QRhi::D3D11)
     {
 #ifdef QRhiD3D11_ACTIVE
         m_dcompDevice = static_cast<QRhiD3D11*>(rhiImplementation)->dcompDevice;
-        m_dcompTarget = static_cast<QD3D11SwapChain*>(rhiSwapChain)->dcompTarget;
-        m_uiVisual = static_cast<QD3D11SwapChain*>(rhiSwapChain)->dcompVisual;
+        auto qswapchain = static_cast<QD3D11SwapChain*>(rhiSwapChain);
+        dcompTarget = qswapchain->dcompTarget;
+        m_uiVisual = qswapchain->dcompVisual;
 #endif
     }
     else if (rhi->backend() == QRhi::D3D12)
     {
 #ifdef QRhiD3D12_ACTIVE
         m_dcompDevice = static_cast<QRhiD3D12*>(rhiImplementation)->dcompDevice;
-        m_dcompTarget = static_cast<QD3D12SwapChain*>(rhiSwapChain)->dcompTarget;
-        m_uiVisual = static_cast<QD3D12SwapChain*>(rhiSwapChain)->dcompVisual;
+        auto qswapchain = static_cast<QD3D12SwapChain*>(rhiSwapChain);
+        dcompTarget = qswapchain->dcompTarget;
+        m_uiVisual = qswapchain->dcompVisual;
 #endif
     }
     else
         Q_UNREACHABLE();
 
     assert(m_dcompDevice);
-    assert(m_dcompTarget);
+    assert(dcompTarget);
     assert(m_uiVisual);
 
     HRESULT res;
     res = m_dcompDevice->CreateVisual(&m_rootVisual);
     assert(res == S_OK);
 
-    res = m_dcompTarget->SetRoot(m_rootVisual.Get());
+    res = dcompTarget->SetRoot(m_rootVisual.Get());
     assert(res == S_OK);
 
     res = m_rootVisual->AddVisual(m_uiVisual, FALSE, NULL);


=====================================
modules/gui/qt/maininterface/compositor_dcomp.hpp
=====================================
@@ -81,7 +81,6 @@ private:
     std::unique_ptr<QQuickView> m_quickView;
 
     IDCompositionDevice *m_dcompDevice = nullptr;
-    IDCompositionTarget *m_dcompTarget = nullptr;
     Microsoft::WRL::ComPtr<IDCompositionVisual> m_rootVisual;
     Microsoft::WRL::ComPtr<IDCompositionVisual> m_videoVisual;
     IDCompositionVisual *m_uiVisual = nullptr;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/40bee9e7d44f603a6df92064cd76cc821c3865f9

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/40bee9e7d44f603a6df92064cd76cc821c3865f9
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list