summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/xinevideowidget.cpp
authoralwin <alwin>2005-03-31 14:24:17 (UTC)
committer alwin <alwin>2005-03-31 14:24:17 (UTC)
commitb135ff0f8c4d1876eea8ecc81e2a821ec8e9cb9a (patch) (unidiff)
tree8cc7536354402f62dd99aac590dd91365abe5183 /noncore/multimedia/opieplayer2/xinevideowidget.cpp
parentdb876361603ccf1664698df926a3c61d32315101 (diff)
downloadopie-b135ff0f8c4d1876eea8ecc81e2a821ec8e9cb9a.zip
opie-b135ff0f8c4d1876eea8ecc81e2a821ec8e9cb9a.tar.gz
opie-b135ff0f8c4d1876eea8ecc81e2a821ec8e9cb9a.tar.bz2
fix for the segfaults when displaying videos (it just had sometimes
invalid inputimages when repainting)
Diffstat (limited to 'noncore/multimedia/opieplayer2/xinevideowidget.cpp') (more/less context) (show 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
@@ -244,61 +244,63 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
244 } 244 }
245 } 245 }
246 246
247 { 247 {
248 // QVFB hack by Martin Jones 248 // QVFB hack by Martin Jones
249 // We need to "touch" all affected clip rects with a normal QPainter in addition to the QDirectPainter 249 // We need to "touch" all affected clip rects with a normal QPainter in addition to the QDirectPainter
250 250
251 QPainter p ( this ); 251 QPainter p ( this );
252 252
253 for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) { 253 for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) {
254 p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [ i ]. topLeft ( )), qt_bug_workaround_clip_rects [ i ]. size ( )), QBrush ( NoBrush )); 254 p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [ i ]. topLeft ( )), qt_bug_workaround_clip_rects [ i ]. size ( )), QBrush ( NoBrush ));
255 } 255 }
256 } 256 }
257 } 257 }
258} 258}
259 259
260 260
261QImage *XineVideoWidget::logo ( ) const 261QImage *XineVideoWidget::logo ( ) const
262{ 262{
263 return m_logo; 263 return m_logo;
264} 264}
265 265
266 266
267void XineVideoWidget::setLogo ( QImage* logo ) 267void XineVideoWidget::setLogo ( QImage* logo )
268{ 268{
269 delete m_logo; 269 delete m_logo;
270 m_logo = logo; 270 m_logo = logo;
271} 271}
272 272
273void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl ) 273void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl )
274{ 274{
275 bool rot90 = (( -m_rotation ) & 1 ); 275 bool rot90 = (( -m_rotation ) & 1 );
276 276
277 if ( rot90 ) { // if the rotation is 90 or 270 we have to swap width / height 277 if ( rot90 ) { // if the rotation is 90 or 270 we have to swap width / height
278 int d = w; 278 int d = w;
279 w = h; 279 w = h;
280 h = d; 280 h = d;
281 } 281 }
282 282
283 m_lastframe = m_thisframe; 283 m_lastframe = m_thisframe;
284 m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h ); 284 m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h );
285 285
286 m_buff = img; 286 m_buff = img;
287 m_bytes_per_line_frame = bpl; 287 m_bytes_per_line_frame = bpl;
288 288
289 // only repaint the area that *really* needs to be repainted 289 // only repaint the area that *really* needs to be repainted
290 290
291 repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false ); 291 repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false );
292 // ensure that we always have a valid frame!
293 m_buff = 0;
292} 294}
293 295
294void XineVideoWidget::resizeEvent ( QResizeEvent * ) 296void XineVideoWidget::resizeEvent ( QResizeEvent * )
295{ 297{
296 emit videoResized( videoSize() ); 298 emit videoResized( videoSize() );
297} 299}
298 300
299 301
300void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ ) 302void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ )
301{ 303{
302 emit clicked(); 304 emit clicked();
303} 305}
304 306