SystemPlugins/CleanupWizard/cleanupwizard.xml: Fix text to make xml2po happy
[enigma2.git] / lib / gui / esubtitle.cpp
index 376fa24d84187844bb26644a9c7dc1ab76acdee9..594ed8a8630082f44870189d8ded43339953bf99 100644 (file)
@@ -62,7 +62,10 @@ void eSubtitleWidget::setPage(const eDVBSubtitlePage &p)
        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()));
+               eDebug("disp width %d, disp height %d", p.m_display_size.width(), p.m_display_size.height());
+               eRect r = eRect(it->m_position, it->m_pixmap->size());
+               r.scale(size().width(), p.m_display_size.width(), size().height(), p.m_display_size.height());
+               m_visible_region.rects.push_back(r);
        }
        m_dvb_page_ok = 1;
        m_hide_subtitles_timer->start(7500, true);
@@ -110,9 +113,18 @@ void eSubtitleWidget::clearPage()
        m_visible_region.rects.clear();
 }
 
-void eSubtitleWidget::setPixmap(ePtr<gPixmap> &pixmap, gRegion changed)
+void eSubtitleWidget::setPixmap(ePtr<gPixmap> &pixmap, gRegion changed, eRect pixmap_dest)
 {
        m_pixmap = pixmap;
+       m_pixmap_dest = pixmap_dest; /* this is in a virtual 720x576 cage */
+       
+               /* incoming "changed" regions are relative to the physical pixmap area, so they have to be scaled to the virtual pixmap area, then to the screen */
+       changed.scale(m_pixmap_dest.width(), 720, m_pixmap_dest.height(), 576);
+       changed.moveBy(ePoint(m_pixmap_dest.x(), m_pixmap_dest.y()));
+
+       if (pixmap->size().width() && pixmap->size().height())
+               changed.scale(size().width(), pixmap->size().width(), size().height(), pixmap->size().height());
+       
        invalidate(changed);
 }
 
@@ -129,8 +141,11 @@ int eSubtitleWidget::event(int event, void *data, void *data2)
                eWidget::event(event, data, data2);
 
                if (m_pixmap)
-                       painter.blit(m_pixmap, ePoint(0,0));
-               else if (m_page_ok)
+               {
+                       eRect r = m_pixmap_dest;
+                       r.scale(size().width(), 720, size().height(), 576);
+                       painter.blitScale(m_pixmap, r);
+               } else if (m_page_ok)
                {
                        int elements = m_page.m_elements.size();
                        painter.setFont(subtitleStyles[Subtitle_TTX].font);
@@ -192,7 +207,11 @@ int eSubtitleWidget::event(int event, void *data, void *data2)
                else if (m_dvb_page_ok)
                {
                        for (std::list<eDVBSubtitleRegion>::iterator it(m_dvb_page.m_regions.begin()); it != m_dvb_page.m_regions.end(); ++it)
-                               painter.blit(it->m_pixmap, it->m_position);
+                       {
+                               eRect r = eRect(it->m_position, it->m_pixmap->size());
+                               r.scale(size().width(), m_dvb_page.m_display_size.width(), size().height(),  m_dvb_page.m_display_size.height());
+                               painter.blitScale(it->m_pixmap, r);
+                       }
                }
                return 0;
        }