diff options
-rw-r--r-- | ttxtsubsdisplay.c | 17 | ||||
-rw-r--r-- | ttxtsubsdisplay.h | 4 |
2 files changed, 12 insertions, 9 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(); } diff --git a/ttxtsubsdisplay.h b/ttxtsubsdisplay.h index bed07d3..c7ff16f 100644 --- a/ttxtsubsdisplay.h +++ b/ttxtsubsdisplay.h @@ -53,8 +53,8 @@ protected: private: void UpdateSubtitleTextLines(); - void DrawOutlinedText(int x, int y, const char* text, tColor textColor, tColor outlineColor, tColor backgroundColor, - const cFont* font); + void DrawOutlinedText(int x, int y, const char* text, tColor textColor, tColor outlineColor, tColor backgroundColor, + const cFont* font, int width, int height); private: int _pageState; |