summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Grimm <git@e-tobi.net>2010-02-28 21:11:56 +0100
committerTobias Grimm <git@e-tobi.net>2010-02-28 21:14:34 +0100
commit135a9a7a954927ab7aea8fc6cb1ec40f1726c38e (patch)
tree6ebc80d4aa77a02901a7f1fe61a68333487ab635
parent2f2f56393e11c2b17cbbfd5298e4a21579109b39 (diff)
downloadvdr-plugin-ttxtsubs-135a9a7a954927ab7aea8fc6cb1ec40f1726c38e.tar.gz
vdr-plugin-ttxtsubs-135a9a7a954927ab7aea8fc6cb1ec40f1726c38e.tar.bz2
Fixed text rendering to not cut off bottom part
(Closes #276)
-rw-r--r--HISTORY1
-rw-r--r--ttxtsubsdisplay.c16
-rw-r--r--ttxtsubsdisplay.h2
3 files changed, 10 insertions, 9 deletions
diff --git a/HISTORY b/HISTORY
index 15c5971..f4f7bc4 100644
--- a/HISTORY
+++ b/HISTORY
@@ -8,6 +8,7 @@ VDR Plugin 'ttxtsubs' Revision History
disappear) (Closes #275)
- French translation updated by Michaƫl Nival (Closes #278)
- Makefile adjustments for VDR 1.7.13.
+- Fixed text rendering to not cut off bottom part (Closes #276)
2010-02-27: Version 0.2.0
- Add Ukrainian translation by Yarema aka Knedlyk (Closes #130)
diff --git a/ttxtsubsdisplay.c b/ttxtsubsdisplay.c
index 148d2c2..7669823 100644
--- a/ttxtsubsdisplay.c
+++ b/ttxtsubsdisplay.c
@@ -375,7 +375,7 @@ void cTtxtSubsDisplay::UpdateSubtitleTextLines()
}
void cTtxtSubsDisplay::DrawOutlinedText(int x, int y, const char* text, tColor textColor, tColor outlineColor,
- tColor backgroundColor, const cFont* font, int width, int height)
+ tColor backgroundColor, const cFont* font)
{
for (int horizontalOffset = -globals.mOutlineWidth; horizontalOffset <= globals.mOutlineWidth; horizontalOffset++)
{
@@ -383,12 +383,11 @@ 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,
- width, height, taCenter);
+ _osd->DrawText(x + horizontalOffset, y + verticalOffset, text, outlineColor, backgroundColor, font);
}
}
}
- _osd->DrawText(x, y, text, textColor, backgroundColor, font, width, height, taCenter);
+ _osd->DrawText(x, y, text, textColor, backgroundColor, font);
}
void cTtxtSubsDisplay::ShowOSD(void)
@@ -407,7 +406,8 @@ void cTtxtSubsDisplay::ShowOSD(void)
DELETENULL(_osd);
int width = cOsd::OsdWidth();
- int height = _numberOfSubTitleTextLines * _osdFont->Height() + 2 * globals.mOutlineWidth + 5;
+ int textHeight = _numberOfSubTitleTextLines * _osdFont->Height();
+ int height = textHeight + 2 * globals.mOutlineWidth + 10;
_osd = cOsdProvider::NewOsd(cOsd::OsdLeft(), cOsd::OsdTop() + cOsd::OsdHeight() - height, OSD_LEVEL_SUBTITLES + 1);
tArea Areas[] = { { 0, 0, width - 1, height - 1, 8 } };
@@ -426,15 +426,15 @@ void cTtxtSubsDisplay::ShowOSD(void)
for(int textLineIndex = 0; textLineIndex < _numberOfSubTitleTextLines; textLineIndex++)
{
int lineWidth = _osdFont->Width(_subTitleTextLines[textLineIndex].text) + 2 * globals.mOutlineWidth + 5;
- int lineHeight = (height / _numberOfSubTitleTextLines) + 5;
+ int lineHeight = (textHeight / _numberOfSubTitleTextLines);
int x = (width - lineWidth) / 2;
- int y = lineHeight * textLineIndex;
+ int y = lineHeight * textLineIndex + globals.mOutlineWidth + 5;
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, lineWidth, (height / _numberOfSubTitleTextLines));
+ _osdFont);
}
_osd->Flush();
}
diff --git a/ttxtsubsdisplay.h b/ttxtsubsdisplay.h
index 25a8c53..76c897d 100644
--- a/ttxtsubsdisplay.h
+++ b/ttxtsubsdisplay.h
@@ -54,7 +54,7 @@ protected:
private:
void UpdateSubtitleTextLines();
void DrawOutlinedText(int x, int y, const char* text, tColor textColor, tColor outlineColor, tColor backgroundColor,
- const cFont* font, int width, int height);
+ const cFont* font);
private:
int _pageState;