-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index 7f59085..78ebe19 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp @@ -1,13 +1,12 @@ - /* This file is part of the Opie Project Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public @@ -206,41 +205,46 @@ void XineVideoWidget::paintEvent2 ( QPaintEvent * ) _vh = m_framesize.width(); _vw = m_framesize.height(); break; default: _vw = m_framesize.width(); _vh = m_framesize.height(); break; break; } int middle_w = _vw/2; int middle_h = _vh/2; m_thisframe.setRect(width()/2-middle_w,height()/2-middle_h,_vw,_vh); - QRect topFill,rightFill,leftFill,downFill; - topFill. setRect(0,0 ,width(),m_thisframe.top()); - downFill.setCoords(0,m_thisframe.bottom(),width(),height()); - rightFill.setCoords(m_thisframe.right(),0,width(),height()); - leftFill.setCoords(0,0,m_thisframe.left(),height()); - - if (topFill.isValid()) { - p.fillRect(topFill,black); - } - if (downFill.isValid()) { - p.fillRect(downFill,black); - } - if (rightFill.isValid()) { - p.fillRect(rightFill,black); - } - if (leftFill.isValid()) { - p.fillRect(leftFill,black); + + { + // is this stuff realy needed? it seems working without, too. + QRect topFill,rightFill,leftFill,downFill; + topFill. setRect(0,0 ,width(),m_thisframe.top()); + downFill.setCoords(0,m_thisframe.bottom(),width(),height()); + rightFill.setCoords(m_thisframe.right(),0,width(),height()); + leftFill.setCoords(0,0,m_thisframe.left(),height()); + + if (topFill.isValid()) { + p.fillRect(topFill,black); + } + if (downFill.isValid()) { + p.fillRect(downFill,black); + } + if (rightFill.isValid()) { + p.fillRect(rightFill,black); + } + if (leftFill.isValid()) { + p.fillRect(leftFill,black); + } + } uchar *fb = dp. frameBuffer ( ); uchar *frame = m_buff; // where is the video frame in fb coordinates QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); uchar * src = frame; uchar * dst = fb+framerect.y()*m_bytes_per_line_fb+framerect.x()*m_bytes_per_pixel; for (int y=framerect.top();y<=framerect.bottom();++y) { @@ -258,31 +262,24 @@ void XineVideoWidget::paintEvent2 ( QPaintEvent * ) src-=m_bytes_per_line_frame; break; case 3: memcpy_step_rev ( dst, src, m_thisframe.size().width(), m_bytes_per_line_frame ); src += m_bytes_per_pixel; break; default: break; } dst += m_bytes_per_line_fb; } } - - - { - // QVFB hack by Martin Jones - // We need to "touch" all affected clip rects with a normal QPainter in addition to the QDirectPainter - p.fillRect(QRect(mapFromGlobal (m_thisframe. topLeft ( )), m_thisframe.size ()),QBrush(NoBrush)); - } } } QImage *XineVideoWidget::logo ( ) const { return m_logo; } void XineVideoWidget::setLogo ( QImage* logo ) { delete m_logo; @@ -302,37 +299,34 @@ void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl ) int l = h*bpl; if (l!=m_lastsize) { if (m_buff) { delete[]m_buff; } if (l>0) { m_buff = new uchar[l]; odebug << "Point to: " << (unsigned long)m_buff << oendl; m_lastsize=l; } else { m_buff = 0; } - } else if (l==0){ - delete[] m_buff; - m_buff = 0; } m_lastsize = l; m_framesize = QSize(w,h); if (m_buff && m_lastsize) { memcpy(m_buff,img,m_lastsize); } m_bytes_per_line_frame = bpl; } // Release Mutex - paintEvent2(0); + if (m_buff) paintEvent2(0); } void XineVideoWidget::resizeEvent ( QResizeEvent * ) { emit videoResized( videoSize() ); } void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ ) { emit clicked(); } |