Merge branch 'master' of git.opendreambox.org:/git/enigma2
authorFelix Domke <tmbinc@elitedvb.net>
Tue, 9 Jun 2009 00:19:52 +0000 (02:19 +0200)
committerFelix Domke <tmbinc@elitedvb.net>
Tue, 9 Jun 2009 00:19:52 +0000 (02:19 +0200)
lib/gui/esubtitle.cpp
lib/gui/esubtitle.h
lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp

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
index ea1afec402ca933d58da7220d1485bce900fe5f1..cf26f35d04b2c12ab2010c3142b65a1df284e207 100644 (file)
@@ -182,7 +182,19 @@ void eServiceDVD::gotMessage(int /*what*/)
                        if (m_subtitle_widget) {
                                int x1,x2,y1,y2;
                                ddvd_get_last_blit_area(m_ddvdconfig, &x1, &x2, &y1, &y2);
-                               m_subtitle_widget->setPixmap(m_pixmap, eRect(x1, y1, (x2-x1)+1, (y2-y1)+1));
+                               
+                               int x_offset = 0, y_offset = 0, width = 720, height = 576;
+
+#ifdef DDVD_SUPPORTS_GET_BLIT_DESTINATION
+                               ddvd_get_blit_destination(m_ddvdconfig, &x_offset, &y_offset, &width, &height);
+                               eDebug("values got from ddvd: %d %d %d %d", x_offset, y_offset, width, height);
+                               width -= x_offset * 2;
+                               height -= y_offset * 2;
+#endif
+                               eRect dest(x_offset, y_offset, width, height);
+
+                               if (dest.width() && dest.height())
+                                       m_subtitle_widget->setPixmap(m_pixmap, eRect(x1, y1, (x2-x1)+1, (y2-y1)+1), dest);
                        }
                        break;
                case DDVD_SHOWOSD_STATE_PLAY:
@@ -567,7 +579,12 @@ RESULT eServiceDVD::enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) /*
        if (!m_pixmap)
        {
                m_pixmap = new gPixmap(size, 32, 1); /* allocate accel surface (if possible) */
+#ifdef DDVD_SUPPORTS_GET_BLIT_DESTINATION
+               ddvd_set_lfb_ex(m_ddvdconfig, (unsigned char *)m_pixmap->surface->data, size.width(), size.height(), 4, size.width()*4, 1);
+#else
                ddvd_set_lfb(m_ddvdconfig, (unsigned char *)m_pixmap->surface->data, size.width(), size.height(), 4, size.width()*4);
+#warning please update libdreamdvd for fast scaling
+#endif
                run(); // start the thread
        }