void SubtitleScreen::Pulse(void) { ExpireSubtitles(); if (kDisplayAVSubtitle == m_subtitleType) DisplayAVSubtitles(); else if (kDisplayTextSubtitle == m_subtitleType) DisplayTextSubtitles(); else if (kDisplayCC608 == m_subtitleType) DisplayCC608Subtitles(); else if (kDisplayCC708 == m_subtitleType) DisplayCC708Subtitles(); else if (kDisplayRawTextSubtitle == m_subtitleType) DisplayRawTextSubtitles(); OptimiseDisplayedArea(); m_refreshArea = false; }
void TeletextScreen::Pulse(void) { if (!InitialiseFont() || !m_displaying) return; if (m_player && m_player->GetVideoOutput()) { static const float kTextPadding = 0.96f; QRect oldsafe = m_safeArea; m_safeArea = m_player->GetVideoOutput()->GetSafeRect(); m_colWidth = (int)((float)m_safeArea.width() / (float)kTeletextColumns); m_rowHeight = (int)((float)m_safeArea.height() / (float)kTeletextRows); if (oldsafe != m_safeArea) { m_teletextReader->SetPageChanged(true); int max_width = (int)((float)m_colWidth * kTextPadding); m_fontHeight = (int)((float)m_rowHeight * kTextPadding); if (max_width > (m_colWidth - 2)) max_width = m_colWidth -2; if (m_fontHeight > (m_rowHeight - 2)) m_fontHeight = m_rowHeight - 2; gTTFont->GetFace()->setPixelSize(m_fontHeight); m_fontStretch = 200; bool ok = false; while (!ok && m_fontStretch > 50) { gTTFont->GetFace()->setStretch(m_fontStretch); QFontMetrics font(*(gTTFont->GetFace())); if (font.averageCharWidth() <= max_width || m_fontStretch < 50) ok = true; else m_fontStretch -= 10; } } } else { return; } if (!m_teletextReader->PageChanged()) return; ClearScreen(); const TeletextSubPage *ttpage = m_teletextReader->FindSubPage(); if (!ttpage) { // no page selected so show the header and a list of available pages DrawHeader(NULL, 0); m_teletextReader->SetPageChanged(false); OptimiseDisplayedArea(); return; } m_teletextReader->SetSubPage(ttpage->subpagenum); int a = 0; if ((ttpage->subtitle) || (ttpage->flags & (TP_SUPPRESS_HEADER | TP_NEWSFLASH | TP_SUBTITLE))) { a = 1; // when showing subtitles we don't want to see the teletext // header line, so we skip that line... m_teletextReader->SetShowHeader(false); m_teletextReader->SetIsSubtitle(true); } else { m_teletextReader->SetShowHeader(true); m_teletextReader->SetIsSubtitle(false); DrawHeader(m_teletextReader->GetHeader(), ttpage->lang); m_teletextReader->SetHeaderChanged(false); } for (int y = kTeletextRows - a; y >= 2; y--) DrawLine(ttpage->data[y-1], y, ttpage->lang); m_teletextReader->SetPageChanged(false); OptimiseDisplayedArea(); }