diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2015-09-25 20:30:35 +0300 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2015-09-25 22:35:46 +0300 |
commit | f4521328c210083cea848880c1f160df3093fef9 (patch) | |
tree | 551c31ab3b01688302881ca364dbe0841f913f61 | |
parent | 3b7c1748eb8c6d749958814dc25cf965581099cc (diff) |
CmadVRAllocatorPresenter: Query interfaces once during initialization.
-rw-r--r-- | src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp | 48 | ||||
-rw-r--r-- | src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h | 7 |
2 files changed, 31 insertions, 24 deletions
diff --git a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp index 581178525..629d7f05f 100644 --- a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp +++ b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.cpp @@ -23,14 +23,9 @@ #include "../../../SubPic/DX9SubPic.h"
#include "../../../SubPic/SubPicQueueImpl.h"
#include "RenderersSettings.h"
-#include <mvrInterfaces.h>
-
using namespace DSObjects;
-#define ShaderStage_PreScale 0
-#define ShaderStage_PostScale 1
-
extern bool g_bExternalSubtitleTime;
//
@@ -168,24 +163,29 @@ STDMETHODIMP CmadVRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer) (*ppRenderer = (IUnknown*)(INonDelegatingUnknown*)(this))->AddRef();
- MONITORINFO mi;
- mi.cbSize = sizeof(MONITORINFO);
+ MONITORINFO mi = { sizeof(MONITORINFO) };
if (GetMonitorInfo(MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), &mi)) {
m_ScreenSize.SetSize(mi.rcMonitor.right - mi.rcMonitor.left, mi.rcMonitor.bottom - mi.rcMonitor.top);
}
+ m_pBV = m_pDXR;
+ m_pBV2 = m_pDXR;
+ m_pMVRC = m_pDXR;
+ m_pMVREPS = m_pDXR;
+ m_pVW = m_pDXR;
+
return S_OK;
}
STDMETHODIMP_(void) CmadVRAllocatorPresenter::SetPosition(RECT w, RECT v)
{
- if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
- pBV->SetDefaultSourcePosition();
- pBV->SetDestinationPosition(v.left, v.top, v.right - v.left, v.bottom - v.top);
+ if (m_pBV) {
+ m_pBV->SetDefaultSourcePosition();
+ m_pBV->SetDestinationPosition(v.left, v.top, v.right - v.left, v.bottom - v.top);
}
- if (CComQIPtr<IVideoWindow> pVW = m_pDXR) {
- pVW->SetWindowPosition(w.left, w.top, w.right - w.left, w.bottom - w.top);
+ if (m_pVW) {
+ m_pVW->SetWindowPosition(w.left, w.top, w.right - w.left, w.bottom - w.top);
}
SetVideoSize(GetVideoSize(), GetVideoSize(true));
@@ -196,22 +196,22 @@ STDMETHODIMP_(SIZE) CmadVRAllocatorPresenter::GetVideoSize(bool bCorrectAR) cons SIZE size = {0, 0};
if (!bCorrectAR) {
- if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
- pBV->GetVideoSize(&size.cx, &size.cy);
+ if (m_pBV) {
+ m_pBV->GetVideoSize(&size.cx, &size.cy);
}
} else {
- if (CComQIPtr<IBasicVideo2> pBV2 = m_pDXR) {
- pBV2->GetPreferredAspectRatio(&size.cx, &size.cy);
+ if (m_pBV2) {
+ m_pBV2->GetPreferredAspectRatio(&size.cx, &size.cy);
}
}
return size;
}
-STDMETHODIMP_(bool) CmadVRAllocatorPresenter::Paint(bool bAll)
+STDMETHODIMP_(bool) CmadVRAllocatorPresenter::Paint(bool /*bAll*/)
{
- if (CComQIPtr<IMadVRCommand> pMVRC = m_pDXR) {
- return SUCCEEDED(pMVRC->SendCommand("redraw"));
+ if (m_pMVRC) {
+ return SUCCEEDED(m_pMVRC->SendCommand("redraw"));
}
return false;
}
@@ -219,8 +219,8 @@ STDMETHODIMP_(bool) CmadVRAllocatorPresenter::Paint(bool bAll) STDMETHODIMP CmadVRAllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size)
{
HRESULT hr = E_NOTIMPL;
- if (CComQIPtr<IBasicVideo> pBV = m_pDXR) {
- hr = pBV->GetCurrentImage((long*)size, (long*)lpDib);
+ if (m_pBV) {
+ hr = m_pBV->GetCurrentImage((long*)size, (long*)lpDib);
}
return hr;
}
@@ -233,11 +233,11 @@ STDMETHODIMP CmadVRAllocatorPresenter::SetPixelShader(LPCSTR pSrcData, LPCSTR pT STDMETHODIMP CmadVRAllocatorPresenter::SetPixelShader2(LPCSTR pSrcData, LPCSTR pTarget, bool bScreenSpace)
{
HRESULT hr = E_NOTIMPL;
- if (CComQIPtr<IMadVRExternalPixelShaders> pEPS = m_pDXR) {
+ if (m_pMVREPS) {
if (!pSrcData && !pTarget) {
- hr = pEPS->ClearPixelShaders(bScreenSpace ? ShaderStage_PostScale : ShaderStage_PreScale);
+ hr = m_pMVREPS->ClearPixelShaders(bScreenSpace ? ShaderStage_PostScale : ShaderStage_PreScale);
} else {
- hr = pEPS->AddPixelShader(pSrcData, pTarget, bScreenSpace ? ShaderStage_PostScale : ShaderStage_PreScale, nullptr);
+ hr = m_pMVREPS->AddPixelShader(pSrcData, pTarget, bScreenSpace ? ShaderStage_PostScale : ShaderStage_PreScale, nullptr);
}
}
return hr;
diff --git a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h index 2bbf45e06..2639008e0 100644 --- a/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h +++ b/src/filters/renderer/VideoRenderers/madVRAllocatorPresenter.h @@ -22,6 +22,7 @@ #include "../SubPic/SubPicAllocatorPresenterImpl.h"
#include "../SubPic/ISubRender.h"
+#include <mvrInterfaces.h>
namespace DSObjects
{
@@ -73,6 +74,12 @@ namespace DSObjects CComPtr<IUnknown> m_pDXR;
CComPtr<ISubRenderCallback2> m_pSRCB;
+ CComQIPtr<IBasicVideo2> m_pBV2;
+ CComQIPtr<IBasicVideo> m_pBV;
+ CComQIPtr<IMadVRCommand> m_pMVRC;
+ CComQIPtr<IMadVRExternalPixelShaders> m_pMVREPS;
+ CComQIPtr<IVideoWindow> m_pVW;
+
CSize m_ScreenSize;
bool m_bIsFullscreen;
|