summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
index 1ac9277..9e86041 100644
--- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp
+++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
@@ -196,109 +196,111 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
uint leftfill = 0; // black border on the "left" side of the video frame
uint framefill = 0; // "width" of the video frame
uint rightfill = 0; // black border on the "right" side of the video frame
uint clipwidth = clip. width ( ) * m_bytes_per_pixel; // "width" of the current clip rect
if ( clip. left ( ) < framerect. left ( ))
leftfill = (( framerect. left ( ) - clip. left ( )) * m_bytes_per_pixel ) <? clipwidth;
if ( clip. right ( ) > framerect. right ( ))
rightfill = (( clip. right ( ) - framerect. right ( )) * m_bytes_per_pixel ) <? clipwidth;
framefill = clipwidth - ( leftfill + rightfill );
for ( int y = clip. top ( ); y <= clip. bottom ( ); y++ ) {
if (( y < framerect. top ( )) || ( y > framerect. bottom ( ))) {
// "above" or "below" the video -> black
memset ( dst, 0, clipwidth );
}
else {
if ( leftfill )
memset ( dst, 0, leftfill ); // "left" border -> black
if ( framefill ) { // blit in the video frame
// see above for an explanation of the different memcpys
switch ( rot ) {
case 0: memcpy ( dst + leftfill, src, framefill & ~1 ); break;
case 1: memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
case 2: memcpy_rev ( dst + leftfill, src, framefill ); break;
case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
default: break;
}
}
if ( rightfill )
memset ( dst + leftfill + framefill, 0, rightfill ); // "right" border -> black
}
dst += m_bytes_per_line_fb; // advance one line in the framebuffer
// advance one "line" in the xine frame data
switch ( rot ) {
case 0: src += m_bytes_per_line_frame; break;
case 1: src -= m_bytes_per_pixel; break;
case 2: src -= m_bytes_per_line_frame; break;
case 3: src += m_bytes_per_pixel; break;
default: break;
}
}
}
}
{
// QVFB hack by Martin Jones
// We need to "touch" all affected clip rects with a normal QPainter in addition to the QDirectPainter
QPainter p ( this );
for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) {
p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [ i ]. topLeft ( )), qt_bug_workaround_clip_rects [ i ]. size ( )), QBrush ( NoBrush ));
}
}
}
}
QImage *XineVideoWidget::logo ( ) const
{
return m_logo;
}
void XineVideoWidget::setLogo ( QImage* logo )
{
delete m_logo;
m_logo = logo;
}
void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl )
{
bool rot90 = (( -m_rotation ) & 1 );
if ( rot90 ) { // if the rotation is 90 or 270 we have to swap width / height
int d = w;
w = h;
h = d;
}
m_lastframe = m_thisframe;
m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h );
m_buff = img;
m_bytes_per_line_frame = bpl;
// only repaint the area that *really* needs to be repainted
repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false );
+ // ensure that we always have a valid frame!
+ m_buff = 0;
}
void XineVideoWidget::resizeEvent ( QResizeEvent * )
{
emit videoResized( videoSize() );
}
void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ )
{
emit clicked();
}