diff options
Diffstat (limited to 'ttxtsubsdisplay.c')
-rw-r--r-- | ttxtsubsdisplay.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/ttxtsubsdisplay.c b/ttxtsubsdisplay.c index 078c9d5..c986818 100644 --- a/ttxtsubsdisplay.c +++ b/ttxtsubsdisplay.c @@ -358,7 +358,7 @@ void cTtxtSubsDisplay::UpdateSubtitleTextLines() } void cTtxtSubsDisplay::DrawOutlinedText(int x, int y, const char* text, tColor textColor, tColor outlineColor, - tColor backgroundColor, const cFont* font) + tColor backgroundColor, const cFont* font, int width, int height) { for (int horizontalOffset = -globals.mOutlineWidth; horizontalOffset <= globals.mOutlineWidth; horizontalOffset++) { @@ -366,11 +366,12 @@ void cTtxtSubsDisplay::DrawOutlinedText(int x, int y, const char* text, tColor t { if (horizontalOffset || verticalOffset) { - _osd->DrawText(x + horizontalOffset, y + verticalOffset, text, outlineColor, backgroundColor, font); + _osd->DrawText(x + horizontalOffset, y + verticalOffset, text, outlineColor, backgroundColor, font, + width, height, taCenter); } } } - _osd->DrawText(x, y, text, textColor, backgroundColor, font); + _osd->DrawText(x, y, text, textColor, backgroundColor, font, width, height, taCenter); } void cTtxtSubsDisplay::ShowOSD(void) @@ -389,7 +390,7 @@ void cTtxtSubsDisplay::ShowOSD(void) DELETENULL(_osd); int width = cOsd::OsdWidth(); - int height = _numberOfSubTitleTextLines * _osdFont->Height(); + int height = _numberOfSubTitleTextLines * _osdFont->Height() + 2 * globals.mOutlineWidth + 5; _osd = cOsdProvider::NewOsd(cOsd::OsdLeft(), cOsd::OsdTop() + cOsd::OsdHeight() - height, OSD_LEVEL_SUBTITLES + 1); tArea Areas[] = { { 0, 0, width - 1, height - 1, 8 } }; @@ -407,14 +408,16 @@ void cTtxtSubsDisplay::ShowOSD(void) for(int textLineIndex = 0; textLineIndex < _numberOfSubTitleTextLines; textLineIndex++) { - int lineWidth = _osdFont->Width(_subTitleTextLines[textLineIndex].text); + int lineWidth = _osdFont->Width(_subTitleTextLines[textLineIndex].text) + 2 * globals.mOutlineWidth + 5; + int lineHeight = (height / _numberOfSubTitleTextLines) + 5; int x = (width - lineWidth) / 2; - int y = (height / _numberOfSubTitleTextLines) * textLineIndex; + int y = lineHeight * textLineIndex; tColor foregroundColor = SubtitleColorMap[_subTitleTextLines[textLineIndex].color][0]; tColor outlineColor = SubtitleColorMap[_subTitleTextLines[textLineIndex].color][1]; tColor backgroundColor = SubtitleColorMap[_subTitleTextLines[textLineIndex].color][2]; - DrawOutlinedText(x, y, _subTitleTextLines[textLineIndex].text, foregroundColor, outlineColor, backgroundColor, _osdFont); + DrawOutlinedText(x, y, _subTitleTextLines[textLineIndex].text, foregroundColor, outlineColor, backgroundColor, + _osdFont, lineWidth, (height / _numberOfSubTitleTextLines)); } _osd->Flush(); } |