properly scale change regions
[enigma2.git] / lib / gui / esubtitle.cpp
index 22ebc8c34935cf4464b0687c54171ab73c1a49b7..5cf4cfa2b6d9c403712845ea83a22cb471bccddb 100644 (file)
@@ -62,7 +62,9 @@ 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()));
+               eRect r = eRect(it->m_position, it->m_pixmap->size());
+               r.scale(size().width(), 720, size().height(), 576);
+               m_visible_region.rects.push_back(r);
        }
        m_dvb_page_ok = 1;
        m_hide_subtitles_timer->start(7500, true);
@@ -113,8 +115,12 @@ void eSubtitleWidget::clearPage()
 void eSubtitleWidget::setPixmap(ePtr<gPixmap> &pixmap, gRegion changed, eRect pixmap_dest)
 {
        m_pixmap = pixmap;
-       m_pixmap_dest = pixmap_dest;
+       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()));
+
        changed.scale(size().width(), pixmap->size().width(), size().height(), pixmap->size().height());
        
        invalidate(changed);