From a67f9c369c2d9c80ab897e855eb232afd5548e1f Mon Sep 17 00:00:00 2001 From: v0lt Date: Mon, 16 Dec 2024 19:31:33 +0300 Subject: [PATCH] =?UTF-8?q?DX11:=20=D1=80=D0=B8=D1=81=D1=83=D0=B5=D0=BC=20?= =?UTF-8?q?=D1=81=D1=83=D0=B1=D1=82=D0=B8=D1=82=D1=80=D1=8B=20=D1=81=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BC=D0=BE=D1=89=D1=8C=D1=8E=20=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=BE?= =?UTF-8?q?=D0=BD=D0=B0=D0=BB=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/DX11VideoProcessor.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Source/DX11VideoProcessor.cpp b/Source/DX11VideoProcessor.cpp index 2a5f1d50..1d7f0002 100644 --- a/Source/DX11VideoProcessor.cpp +++ b/Source/DX11VideoProcessor.cpp @@ -2867,20 +2867,34 @@ HRESULT CDX11VideoProcessor::FinalPass(const Tex2D_t& Tex, ID3D11Texture2D* pRen void CDX11VideoProcessor::DrawSubtitles(ID3D11Texture2D* pRenderTarget) { + HRESULT hr = S_OK; + CComPtr pSubPic = m_pFilter->GetSubPic(m_rtStart); if (pSubPic) { - CRect rcSource, rcDest; - HRESULT hr = pSubPic->GetSourceAndDest(m_windowRect, m_videoRect, rcSource, rcDest, FALSE, {}, 0, FALSE); + RECT rcSource, rcDest; + hr = pSubPic->GetSourceAndDest(m_windowRect, m_videoRect, &rcSource, &rcDest, FALSE, {}, 0, FALSE); if (SUCCEEDED(hr)) { - DLog(L"TEST SubPic: rcSource ({},{},{},{}) , rcDest ({},{},{},{})", - rcSource.left, rcSource.top, rcSource.right, rcSource.bottom, - rcDest.left, rcDest.top, rcDest.right, rcDest.bottom); + ID3D11RenderTargetView* pRenderTargetView; + hr = m_pDevice->CreateRenderTargetView(pRenderTarget, nullptr, &pRenderTargetView); + if (SUCCEEDED(hr)) { + // Set render target and shaders + m_pDeviceContext->OMSetRenderTargets(1, &pRenderTargetView, nullptr); + m_pDeviceContext->IASetInputLayout(m_pVSimpleInputLayout); + m_pDeviceContext->VSSetShader(m_pVS_Simple, nullptr, 0); + m_pDeviceContext->PSSetShader(m_pPS_BitmapToFrame, nullptr, 0); + + // call the function for drawing subtitles + hr = pSubPic->AlphaBlt(&rcSource, &rcDest, nullptr); + + pRenderTargetView->Release(); + } } + return; } if (m_pFilter->m_pSub11CallBack) { ID3D11RenderTargetView* pRenderTargetView; - HRESULT hr = m_pDevice->CreateRenderTargetView(pRenderTarget, nullptr, &pRenderTargetView); + hr = m_pDevice->CreateRenderTargetView(pRenderTarget, nullptr, &pRenderTargetView); if (SUCCEEDED(hr)) { const CRect rSrcPri(POINT(0, 0), m_windowRect.Size()); const CRect rDstVid(m_videoRect);