diff options
-rw-r--r-- | xbmc/cores/VideoRenderers/WinRenderer.cpp | 30 | ||||
-rw-r--r-- | xbmc/cores/VideoRenderers/WinRenderer.h | 2 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp | 4 |
3 files changed, 19 insertions, 17 deletions
diff --git a/xbmc/cores/VideoRenderers/WinRenderer.cpp b/xbmc/cores/VideoRenderers/WinRenderer.cpp index 426ec328c0..d2e31375c8 100644 --- a/xbmc/cores/VideoRenderers/WinRenderer.cpp +++ b/xbmc/cores/VideoRenderers/WinRenderer.cpp @@ -634,35 +634,36 @@ void CWinRenderer::UpdateVideoFilter() } } -void CWinRenderer::CropSource(RECT& src, RECT& dst, const D3DSURFACE_DESC& desc) +// Adjust the src rectangle so that the dst is always contained in the target rectangle. +void CWinRenderer::CropSource(RECT& src, RECT& dst, RECT target) { - if(dst.left < 0) + if(dst.left < target.left) { - src.left -= dst.left + src.left -= (dst.left - target.left) * (src.right - src.left) / (dst.right - dst.left); - dst.left = 0; + dst.left = target.left; } - if(dst.top < 0) + if(dst.top < target.top) { - src.top -= dst.top + src.top -= (dst.top - target.top) * (src.bottom - src.top) / (dst.bottom - dst.top); - dst.top = 0; + dst.top = target.top; } - if(dst.right > (LONG)desc.Width) + if(dst.right > target.right) { - src.right -= (dst.right - desc.Width) + src.right -= (dst.right - target.right) * (src.right - src.left) / (dst.right - dst.left); - dst.right = desc.Width; + dst.right = target.right; } - if(dst.bottom > (LONG)desc.Height) + if(dst.bottom > target.bottom) { - src.bottom -= (dst.bottom - desc.Height) + src.bottom -= (dst.bottom - target.bottom) * (src.bottom - src.top) / (dst.bottom - dst.top); - dst.bottom = desc.Height; + dst.bottom = target.bottom; } } @@ -782,9 +783,10 @@ void CWinRenderer::ScaleStretchRect() D3DSURFACE_DESC desc; if (FAILED(target->GetDesc(&desc))) CLog::Log(LOGERROR, "CWinRenderer::Render - failed to get back buffer description"); + RECT tgtRect = { 0, 0, desc.Width, desc.Height }; // Need to manipulate the coordinates since StretchRect doesn't accept off-screen coordinates. - CropSource(srcRect, dstRect, desc); + CropSource(srcRect, dstRect, tgtRect); HRESULT hr; LPDIRECT3DDEVICE9 pD3DDevice = g_Windowing.Get3DDevice(); diff --git a/xbmc/cores/VideoRenderers/WinRenderer.h b/xbmc/cores/VideoRenderers/WinRenderer.h index 70ff1d6038..7c79c8a1a9 100644 --- a/xbmc/cores/VideoRenderers/WinRenderer.h +++ b/xbmc/cores/VideoRenderers/WinRenderer.h @@ -192,7 +192,7 @@ public: virtual unsigned int GetProcessorSize() { return m_processor.Size(); } - static void CropSource(RECT& src, RECT& dst, const D3DSURFACE_DESC& desc); + static void CropSource(RECT& src, RECT& dst, RECT target); protected: virtual void Render(DWORD flags); diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp index 99caff0a8b..0f515473bf 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp @@ -1439,8 +1439,8 @@ bool CProcessor::Render(RECT src, RECT dst, IDirect3DSurface9* target, REFERENCE D3DSURFACE_DESC desc; CHECK(target->GetDesc(&desc)); - - CWinRenderer::CropSource(src, dst, desc); + RECT recttarget = { 0, 0, desc.Width, desc.Height }; + CWinRenderer::CropSource(src, dst, recttarget); // How to prepare the samples array for VideoProcessBlt // - always provide current picture + the number of forward and backward references required by the current processor. |