From b5ae02df4b1db9e394c1e9f31bcb6dd10c333a18 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 13 Jun 2015 15:29:06 +0200 Subject: renderer: fix mixed-up rd/rv after fd53c703d96d9beec2ccf4e5982bd91aafc29be2, resulted in wrong subtitle positions --- xbmc/cores/VideoRenderers/OverlayRenderer.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp index eae5060e98..5a9f2e8025 100644 --- a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp +++ b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp @@ -235,8 +235,8 @@ void CRenderer::Render(COverlay* o, float adjust_height) if(align == COverlay::ALIGN_SCREEN || align == COverlay::ALIGN_SUBTITLE) { - scale_x = (float)rd.Width(); - scale_y = (float)rd.Height(); + scale_x = (float)rv.Width(); + scale_y = (float)rv.Height(); } if(align == COverlay::ALIGN_VIDEO) @@ -258,19 +258,11 @@ void CRenderer::Render(COverlay* o, float adjust_height) if(align == COverlay::ALIGN_SCREEN || align == COverlay::ALIGN_SUBTITLE) { - float scale_x = rv.Width() / rd.Width(); - float scale_y = rv.Height() / rd.Height(); - - state.x *= scale_x; - state.y *= scale_y; - state.width *= scale_x; - state.height *= scale_y; - if(align == COverlay::ALIGN_SUBTITLE) { RESOLUTION_INFO res = g_graphicsContext.GetResInfo(g_renderManager.GetResolution()); state.x += rv.x1 + rv.Width() * 0.5f; - state.y += rv.y1 + (res.iSubtitles - res.Overscan.top) * scale_y; + state.y += rv.y1 + (res.iSubtitles - res.Overscan.top); } else { -- cgit v1.2.3 From 54137be7060a1f791582244ae2ae3d5799fc1271 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 13 Jun 2015 15:30:32 +0200 Subject: renderer: fix overlapping subtitles for alignments other than fixed --- xbmc/cores/VideoRenderers/OverlayRenderer.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp index 5a9f2e8025..08ffdc659b 100644 --- a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp +++ b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp @@ -188,12 +188,13 @@ void CRenderer::Render(int idx) } float total_height = 0.0f; + float cur_height = 0.0f; + int subalign = CSettings::Get().GetInt("subtitles.align"); for (std::vector::iterator it = render.begin(); it != render.end(); ++it) { COverlay* o = *it; o->PrepareRender(); - if (o->m_align == COverlay::ALIGN_SUBTITLE) - total_height += o->m_height; + total_height += o->m_height; } for (std::vector::iterator it = render.begin(); it != render.end(); ++it) @@ -201,7 +202,14 @@ void CRenderer::Render(int idx) COverlay* o = *it; float adjust_height = 0.0f; - if (o->m_align == COverlay::ALIGN_SUBTITLE) + + if(subalign == SUBTITLE_ALIGN_TOP_INSIDE || + subalign == SUBTITLE_ALIGN_TOP_OUTSIDE) + { + adjust_height = cur_height; + cur_height += o->m_height; + } + else { total_height -= o->m_height; adjust_height = -total_height; -- cgit v1.2.3 From 74ad4c1b21da1245edd05846a4bae6132dbb4485 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 14 Jun 2015 10:07:59 +0200 Subject: renderer: fix subtitle (text) positions for alignment outside video, consider height of text --- xbmc/cores/VideoRenderers/OverlayRendererGUI.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xbmc/cores/VideoRenderers/OverlayRendererGUI.cpp b/xbmc/cores/VideoRenderers/OverlayRendererGUI.cpp index da864a3419..c77ce0316b 100644 --- a/xbmc/cores/VideoRenderers/OverlayRendererGUI.cpp +++ b/xbmc/cores/VideoRenderers/OverlayRendererGUI.cpp @@ -170,7 +170,8 @@ void COverlayText::Render(OVERLAY::SRenderState &state) mat.m[0][3] = rd.x1; mat.m[1][3] = rd.y1; - float x = state.x, y = state.y; + float x = state.x; + float y = state.y; mat.InverseTransformPosition(x, y); g_graphicsContext.SetTransform(mat, 1.0f, 1.0f); @@ -178,7 +179,7 @@ void COverlayText::Render(OVERLAY::SRenderState &state) float width_max = (float) res.Overscan.right - res.Overscan.left; if (m_subalign == SUBTITLE_ALIGN_MANUAL - || m_subalign == SUBTITLE_ALIGN_TOP_OUTSIDE + || m_subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE || m_subalign == SUBTITLE_ALIGN_BOTTOM_INSIDE) y -= m_height; -- cgit v1.2.3