From 0eb98dcebf3ff5c8fbdc1235474c0d5640f9a04c Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 10 Jan 2011 00:05:13 +0000 Subject: legacy branch: merge r2785-r2825,r2827 from trunk git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/branches/legacy@2830 10f7b99b-c216-0410-bff0-8a66a9350fd8 --- src/SubPic/SubPicAllocatorPresenterImpl.cpp | 89 +++++++++++++++-------------- 1 file changed, 45 insertions(+), 44 deletions(-) (limited to 'src/SubPic/SubPicAllocatorPresenterImpl.cpp') diff --git a/src/SubPic/SubPicAllocatorPresenterImpl.cpp b/src/SubPic/SubPicAllocatorPresenterImpl.cpp index 936940d14..2d90c85fd 100644 --- a/src/SubPic/SubPicAllocatorPresenterImpl.cpp +++ b/src/SubPic/SubPicAllocatorPresenterImpl.cpp @@ -35,11 +35,11 @@ CSubPicAllocatorPresenterImpl::CSubPicAllocatorPresenterImpl(HWND hWnd, HRESULT& , m_bDeviceResetRequested(false) , m_bPendingResetDevice(false) { - if(!IsWindow(m_hWnd)) - { + if(!IsWindow(m_hWnd)) { hr = E_INVALIDARG; - if (_pError) + if (_pError) { *_pError += "Invalid window handle in ISubPicAllocatorPresenterImpl\n"; + } return; } GetWindowRect(m_hWnd, &m_WindowRect); @@ -63,31 +63,31 @@ STDMETHODIMP CSubPicAllocatorPresenterImpl::NonDelegatingQueryInterface(REFIID r void CSubPicAllocatorPresenterImpl::AlphaBltSubPic(CSize size, SubPicDesc* pTarget) { CComPtr pSubPic; - if(m_pSubPicQueue->LookupSubPic(m_rtNow, pSubPic)) - { + if(m_pSubPicQueue->LookupSubPic(m_rtNow, pSubPic)) { CRect rcSource, rcDest; - if (SUCCEEDED (pSubPic->GetSourceAndDest(&size, rcSource, rcDest))) + if (SUCCEEDED (pSubPic->GetSourceAndDest(&size, rcSource, rcDest))) { pSubPic->AlphaBlt(rcSource, rcDest, pTarget); -/* SubPicDesc spd; - pSubPic->GetDesc(spd); - - if(spd.w > 0 && spd.h > 0) - { - CRect r; - pSubPic->GetDirtyRect(r); - - // FIXME - r.DeflateRect(1, 1); - - CRect rDstText( - r.left * size.cx / spd.w, - r.top * size.cy / spd.h, - r.right * size.cx / spd.w, - r.bottom * size.cy / spd.h); - - pSubPic->AlphaBlt(r, rDstText, pTarget); } -*/ + /* SubPicDesc spd; + pSubPic->GetDesc(spd); + + if(spd.w > 0 && spd.h > 0) + { + CRect r; + pSubPic->GetDirtyRect(r); + + // FIXME + r.DeflateRect(1, 1); + + CRect rDstText( + r.left * size.cx / spd.w, + r.top * size.cy / spd.h, + r.right * size.cx / spd.w, + r.bottom * size.cy / spd.h); + + pSubPic->AlphaBlt(r, rDstText, pTarget); + } + */ } } @@ -97,8 +97,9 @@ STDMETHODIMP_(SIZE) CSubPicAllocatorPresenterImpl::GetVideoSize(bool fCorrectAR) { CSize VideoSize(GetVisibleVideoSize()); - if(fCorrectAR && m_AspectRatio.cx > 0 && m_AspectRatio.cy > 0) + if(fCorrectAR && m_AspectRatio.cx > 0 && m_AspectRatio.cy > 0) { VideoSize.cx = (LONGLONG(VideoSize.cy)*LONGLONG(m_AspectRatio.cx))/LONGLONG(m_AspectRatio.cy); + } return(VideoSize); } @@ -114,34 +115,31 @@ STDMETHODIMP_(void) CSubPicAllocatorPresenterImpl::SetPosition(RECT w, RECT v) m_VideoRect = v; - if(fWindowSizeChanged || fVideoRectChanged) - { - if(m_pAllocator) - { + if(fWindowSizeChanged || fVideoRectChanged) { + if(m_pAllocator) { m_pAllocator->SetCurSize(m_WindowRect.Size()); m_pAllocator->SetCurVidRect(m_VideoRect); } - if(m_pSubPicQueue) - { + if(m_pSubPicQueue) { m_pSubPicQueue->Invalidate(); } } - if(fWindowPosChanged || fVideoRectChanged) + if(fWindowPosChanged || fVideoRectChanged) { Paint(fWindowSizeChanged || fVideoRectChanged); + } } STDMETHODIMP_(void) CSubPicAllocatorPresenterImpl::SetTime(REFERENCE_TIME rtNow) { -/* - if(m_rtNow <= rtNow && rtNow <= m_rtNow + 1000000) - return; -*/ + /* + if(m_rtNow <= rtNow && rtNow <= m_rtNow + 1000000) + return; + */ m_rtNow = rtNow - m_rtSubtitleDelay; - if(m_pSubPicQueue) - { + if(m_pSubPicQueue) { m_pSubPicQueue->SetTime(m_rtNow); } } @@ -165,14 +163,16 @@ STDMETHODIMP_(void) CSubPicAllocatorPresenterImpl::SetSubPicProvider(ISubPicProv { m_SubPicProvider = pSubPicProvider; - if(m_pSubPicQueue) + if(m_pSubPicQueue) { m_pSubPicQueue->SetSubPicProvider(pSubPicProvider); + } } STDMETHODIMP_(void) CSubPicAllocatorPresenterImpl::Invalidate(REFERENCE_TIME rtInvalidate) { - if(m_pSubPicQueue) + if(m_pSubPicQueue) { m_pSubPicQueue->Invalidate(rtInvalidate); + } } #include @@ -187,8 +187,7 @@ void CSubPicAllocatorPresenterImpl::Transform(CRect r, Vector v[4]) Vector center(r.CenterPoint().x, r.CenterPoint().y, 0); int l = (int)(Vector(r.Size().cx, r.Size().cy, 0).Length()*1.5f)+1; - for(ptrdiff_t i = 0; i < 4; i++) - { + for(ptrdiff_t i = 0; i < 4; i++) { v[i] = m_xform << (v[i] - center); v[i].z = v[i].z / l + 0.5f; v[i].x /= v[i].z*2; @@ -200,6 +199,8 @@ void CSubPicAllocatorPresenterImpl::Transform(CRect r, Vector v[4]) STDMETHODIMP CSubPicAllocatorPresenterImpl::SetVideoAngle(Vector v, bool fRepaint) { m_xform = XForm(Ray(Vector(0, 0, 0), v), Vector(1, 1, 1), false); - if(fRepaint) Paint(true); + if(fRepaint) { + Paint(true); + } return S_OK; } -- cgit v1.2.3