allow scale of pixmap subtitles
authorFelix Domke <tmbinc@elitedvb.net>
Mon, 8 Jun 2009 23:59:07 +0000 (01:59 +0200)
committerFelix Domke <tmbinc@elitedvb.net>
Mon, 8 Jun 2009 23:59:07 +0000 (01:59 +0200)
lib/gui/esubtitle.cpp
lib/gui/esubtitle.h

index bf0239dffdae8741f1c82122e26bcb52aa693ced..22ebc8c34935cf4464b0687c54171ab73c1a49b7 100644 (file)
@@ -110,9 +110,10 @@ 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;
        
        changed.scale(size().width(), pixmap->size().width(), size().height(), pixmap->size().height());
        
@@ -132,8 +133,11 @@ int eSubtitleWidget::event(int event, void *data, void *data2)
                eWidget::event(event, data, data2);
 
                if (m_pixmap)
-                       painter.blitScale(m_pixmap, eRect(ePoint(0, 0), size()));
-               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);
index d22ea0b86f6ff17d1ceb2b463bc82cbb565af2f8..45345db1d89d2857c86c5865b0475eb3ed4d60e9 100644 (file)
@@ -42,7 +42,7 @@ public:
        void setPage(const eDVBSubtitlePage &p);
        void setPage(const ePangoSubtitlePage &p);
        void clearPage();
-       void setPixmap(ePtr<gPixmap> &pixmap, gRegion changed);
+       void setPixmap(ePtr<gPixmap> &pixmap, gRegion changed, eRect dest = eRect(0, 0, 720, 576));
 
        typedef enum { Subtitle_TTX, Subtitle_Regular, Subtitle_Bold, Subtitle_Italic, Subtitle_MAX } subfont_t;
        struct eSubtitleStyle
@@ -75,6 +75,7 @@ private:
        static eSubtitleStyle subtitleStyles[Subtitle_MAX];
 
        ePtr<gPixmap> m_pixmap;  // pixmap to paint on next evtPaint
+       eRect m_pixmap_dest;
 };
 
 #endif