diff options
author | Martijn Kaijser <martijn@xbmc.org> | 2015-06-14 13:59:46 +0200 |
---|---|---|
committer | Martijn Kaijser <martijn@xbmc.org> | 2015-06-14 13:59:46 +0200 |
commit | daedd5ff9439e574363826553664f2e479528640 (patch) | |
tree | 060d763a31219ef3310ad0f85c2f3159948fd468 | |
parent | 91a85f0c2ca53965b9161817683314779f76d227 (diff) | |
parent | 74ad4c1b21da1245edd05846a4bae6132dbb4485 (diff) |
Merge pull request #7277 from FernetMenta/subs15.0b2-Isengard
fix subtitle positions
-rw-r--r-- | xbmc/cores/VideoRenderers/OverlayRenderer.cpp | 28 | ||||
-rw-r--r-- | xbmc/cores/VideoRenderers/OverlayRendererGUI.cpp | 5 |
2 files changed, 17 insertions, 16 deletions
diff --git a/xbmc/cores/VideoRenderers/OverlayRenderer.cpp b/xbmc/cores/VideoRenderers/OverlayRenderer.cpp index eae5060e98..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<COverlay*>::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<COverlay*>::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; @@ -235,8 +243,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 +266,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 { 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; |