void eSubtitleWidget::setPage(const eDVBSubtitlePage &p)
{
+ eDebug("setPage");
m_dvb_page = p;
invalidate(m_visible_region); // invalidate old visible regions
m_visible_region.rects.clear();
for (std::list<eDVBSubtitleRegion>::iterator it(m_dvb_page.m_regions.begin()); it != m_dvb_page.m_regions.end(); ++it)
+ {
+ eDebug("add %d %d %d %d", it->m_position.x(), it->m_position.y(), it->m_pixmap->size().width(), it->m_pixmap->size().height());
m_visible_region.rects.push_back(eRect(it->m_position, it->m_pixmap->size()));
+ }
m_dvb_page_ok = 1;
m_hide_subtitles_timer.start(7500, true);
invalidate(m_visible_region); // invalidate new regions
m_visible_region.rects.clear();
}
+void eSubtitleWidget::setPixmap(ePtr<gPixmap> &pixmap, gRegion changed)
+{
+ m_pixmap = pixmap;
+ invalidate(changed);
+}
+
int eSubtitleWidget::event(int event, void *data, void *data2)
{
switch (event)
gPainter &painter = *(gPainter*)data2;
getStyle(style);
-
eWidget::event(event, data, data2);
- ePtr<gFont> font = new gFont("Regular", 38);
- painter.setFont(font);
-
- if (m_page_ok)
+
+ if (m_pixmap)
+ painter.blit(m_pixmap, ePoint(0,0));
+ else if (m_page_ok)
{
int elements = m_page.m_elements.size();
+ ePtr<gFont> font = new gFont("Regular", 38);
+ painter.setFont(font);
for (int i=0; i<elements; ++i)
{
eDVBTeletextSubtitlePageElement &element = m_page.m_elements[i];
eRect &area = element.m_area;
eRect shadow = area;
shadow.moveBy(3,3);
- std::string text = convertLatin1UTF8(element.m_text);
painter.setForegroundColor(gRGB(0,0,0));
- painter.renderText(shadow, text, gPainter::RT_WRAP|gPainter::RT_VALIGN_CENTER|gPainter::RT_HALIGN_CENTER);
+ painter.renderText(shadow, element.m_text, gPainter::RT_WRAP|gPainter::RT_VALIGN_CENTER|gPainter::RT_HALIGN_CENTER);
painter.setForegroundColor(element.m_color);
- painter.renderText(area, text, gPainter::RT_WRAP|gPainter::RT_VALIGN_CENTER|gPainter::RT_HALIGN_CENTER);
+ painter.renderText(area, element.m_text, gPainter::RT_WRAP|gPainter::RT_VALIGN_CENTER|gPainter::RT_HALIGN_CENTER);
}
}
else if (m_dvb_page_ok)