author | sandman <sandman> | 2002-08-01 01:33:23 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-08-01 01:33:23 (UTC) |
commit | 32b7fdb0e9e5ec6cb6f791962efe68c40564b178 (patch) (side-by-side diff) | |
tree | 86044a8b3884536f65d38b32d3e0552c30f13a81 /noncore/multimedia/opieplayer2/xinevideowidget.cpp | |
parent | ba034bf4cb91b83654056945fc27313a28528015 (diff) | |
download | opie-32b7fdb0e9e5ec6cb6f791962efe68c40564b178.zip opie-32b7fdb0e9e5ec6cb6f791962efe68c40564b178.tar.gz opie-32b7fdb0e9e5ec6cb6f791962efe68c40564b178.tar.bz2 |
Fixed video output (frames allocated before video was enabled via
show_video flag have never been displayes thereafter)
Also optimized the video widget
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 @@ -46,7 +46,7 @@ XineVideoWidget::XineVideoWidget( int width, int height, QWidget* parent, const char* name ) - : QWidget( parent, name ) + : QWidget( parent, name, WRepaintNoErase | WResizeNoErase ) { m_image = new QImage( width, height, qt_screen->depth() ); m_buff = 0; @@ -61,32 +61,43 @@ 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{ return m_image->height(); @@ -101,30 +112,14 @@ void XineVideoWidget::setImage( QImage* image ) { 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 ); } |