Diffstat (limited to 'noncore/multimedia/opieplayer2/xinevideowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 79 |
1 files changed, 37 insertions, 42 deletions
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index d665f16..b5a714e 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp @@ -47,5 +47,5 @@ XineVideoWidget::XineVideoWidget( int width, QWidget* parent, const char* name ) - : QWidget( parent, name ) + : QWidget( parent, name, WRepaintNoErase | WResizeNoErase ) { m_image = new QImage( width, height, qt_screen->depth() ); @@ -62,30 +62,41 @@ XineVideoWidget::~XineVideoWidget() { void XineVideoWidget::clear() { m_buff = 0; - repaint(); + repaint(false); } void XineVideoWidget::paintEvent( QPaintEvent* e ) { qWarning("painting"); - QPainter p(this ); - p.setBrush( QBrush( Qt::black ) ); - p.drawRect( rect() ); - if (m_buff == 0 ) + if (m_buff == 0 ) { + QPainter p(this ); + p.fillRect( rect(), black ); p.drawImage( 0, 0, *m_image ); - else { + qWarning ( "logo\n" ); + } + else { qWarning("paitnevent\n"); - - QDirectPainter dp( this ); - uchar* dst = dp.frameBuffer() + (m_yOff + dp.yOffset() ) * linestep + - (m_xOff + dp.xOffset() ) * m_bytes_per_pixel; - uchar* frame = m_buff; - for(int y = 0; y < m_Height; y++ ) { - memcpy( dst, frame, m_bytes ); - frame += m_bytes; - dst += linestep; + { + + if (( m_thisframe & m_lastframe ) != m_lastframe ) { + QPainter p ( this ); + p. fillRect ( m_lastframe, black ); + } + } + { + QDirectPainter dp ( this ); + + uchar* dst = dp.frameBuffer() + (m_thisframe. y ( ) + dp.yOffset() ) * linestep + + (m_thisframe. x ( ) + dp.xOffset() ) * m_bytes_per_pixel; + uchar* frame = m_buff; + for(int y = 0; y < m_thisframe. height ( ); y++ ) { + memcpy( dst, frame, m_bytes ); + frame += m_bytes; + dst += linestep; + } } - // QVFB hack by MArtin Jones -// QPainter dp2(this); - // dp2.fillRect( rect(), QBrush( NoBrush ) ); + { + // QVFB hack by MArtin Jones + QPainter p ( this ); + p. fillRect ( m_thisframe, QBrush ( NoBrush )); + } } -// QWidget::paintEvent( e ); } int XineVideoWidget::height() const{ @@ -102,29 +113,13 @@ void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, int xoffsetXBytes, int width, int height, int linestep, int bytes, int bpp ) { -/* if (m_buff != 0 ) - free(m_buff ); -*/ + + m_lastframe = m_thisframe; + m_thisframe. setRect ( xoffsetXBytes, yoffsetXLine, width, height ); + m_buff = image; - m_yOff = yoffsetXLine; - m_xOff = xoffsetXBytes; - m_Width = width; - m_Height = height; this->linestep = linestep; m_bytes = bytes; m_bytes_per_pixel = bpp; - //// - qWarning("width %d %d", width, height ); -/* QDirectPainter dp( this ); - uchar* dst = dp.frameBuffer() + (m_yOff + dp.yOffset() ) * linestep + - (m_xOff + dp.xOffset() ) * m_bytes_per_pixel; - uchar* frame = m_buff; - for(int y = 0; y < m_Height; y++ ) { - memcpy( dst, frame, m_bytes ); - frame += m_bytes; - dst += linestep; - } - // QVFB hack - QPainter dp2(this); - dp2.fillRect( rect(), QBrush( NoBrush ) ); -*/ + + repaint ( false ); } |