Skip to content

Commit

Permalink
Subtitles: Only display teletext captions inside the "box" area.
Browse files Browse the repository at this point in the history
The spec says that characters outside the "Start Box" / "End Box"
region should not be displayed.  Refs #10678.
  • Loading branch information
stichnot committed Jun 2, 2012
1 parent b1eb74d commit 419fc84
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions mythtv/libs/libmythtv/teletextscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ void TeletextScreen::DrawLine(const uint8_t *page, uint row, int lang)
bool hold;
bool endbox;
bool startbox;
bool withinbox;

unsigned char last_ch = ' ';
unsigned char ch;
Expand Down Expand Up @@ -376,6 +377,7 @@ void TeletextScreen::DrawLine(const uint8_t *page, uint row, int lang)
hold = false;
endbox = false;
startbox = false;
withinbox = false;
uint flof_link_count = 0;
uint old_bgcolor = bgcolor;

Expand All @@ -393,12 +395,14 @@ void TeletextScreen::DrawLine(const uint8_t *page, uint row, int lang)
if (kTTColorTransparent & bgcolor)
bgcolor = bgcolor & ~kTTColorTransparent;
startbox = false;
withinbox = true;
}

if (endbox)
{
bgcolor = old_bgcolor;
endbox = false;
withinbox = false;
}

SetForegroundColor(fgcolor);
Expand Down Expand Up @@ -506,19 +510,22 @@ void TeletextScreen::DrawLine(const uint8_t *page, uint row, int lang)
if (m_teletextReader->IsTransparent())
SetBackgroundColor(kTTColorTransparent);

DrawBackground(x, row);
if (doubleheight && row < (uint)kTeletextRows)
DrawBackground(x, row + 1);

if ((mosaic) && (ch < 0x40 || ch > 0x5F))
{
SetBackgroundColor(newfgcolor);
DrawMosaic(x, row, ch, doubleheight);
}
else
if (withinbox || !m_teletextReader->IsSubtitle())
{
char c2 = cvt_char(ch, lang);
DrawCharacter(x, row, c2, doubleheight);
DrawBackground(x, row);
if (doubleheight && row < (uint)kTeletextRows)
DrawBackground(x, row + 1);

if ((mosaic) && (ch < 0x40 || ch > 0x5F))
{
SetBackgroundColor(newfgcolor);
DrawMosaic(x, row, ch, doubleheight);
}
else
{
char c2 = cvt_char(ch, lang);
DrawCharacter(x, row, c2, doubleheight);
}
}
}
}
Expand Down

0 comments on commit 419fc84

Please sign in to comment.