-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 87 |
1 files changed, 25 insertions, 62 deletions
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index 8e8f139..4b69044 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp @@ -38,2 +38,3 @@ #include <qdirectpainter_qws.h> +#include <qgfx_qws.h> #include <qsize.h> @@ -57,6 +58,2 @@ static inline void memcpy_step ( void *dst, void *src, size_t len, size_t step ) while ( len-- ) { -// *((char *) dst ) = *((char *) src + 1); -// *((char *) dst + 1) = *((char *) src ); -// ((char *) dst ) += 2; - *((short int *) dst )++ = *((short int *) src ); @@ -75,6 +72,2 @@ static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t st *((short int *) dst )++ = *((short int *) src ); - -// *((char *) dst ) = *((char *) src + 1); -// *((char *) dst + 1) = *((char *) src ); -// ((char *) dst ) += 2; } @@ -111,3 +104,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) { - qWarning( "painting <<<" ); + //qWarning( "painting <<<" ); if ( m_buff == 0 ) { @@ -116,3 +109,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) p. drawImage ( 0, 0, *m_image ); - qWarning ( "logo\n" ); + //qWarning ( "logo\n" ); } @@ -131,3 +124,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) - QRect framerect = QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )); + QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); @@ -138,10 +131,13 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) - qt_bug_workaround_clip_rects [i] = clip; + qt_bug_workaround_clip_rects [i] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); - if ( rot == 0 || rot == 180 ) { uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb ); - uchar *src = frame + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ); + uchar *src = frame; - if ( rot == 180 ) - src += (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame ); + switch ( rot ) { + case 0: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) ); break; + case 1: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_pixel ) ); break; + case 2: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame ) ); break; + case 3: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) ); break; + } @@ -168,47 +164,8 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) if ( framefill ) { - if ( rot == 0 ) - memcpy ( dst + leftfill, src, framefill ); - else - memcpy_rev ( dst + leftfill, src, framefill ); - } - if ( rightfill ) - memset ( dst + leftfill + framefill, 0, rightfill ); - } - - dst += m_bytes_per_line_fb; - src += ( rot == 0 ? m_bytes_per_line_frame : -m_bytes_per_line_frame ); - } - } - else { // rot == 90 || rot == 270 - uchar *dst = fb + ( clip. y ( ) * m_bytes_per_pixel ) + ( clip. x ( ) * m_bytes_per_line_fb ); - uchar *src = frame + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ); - - if ( rot == 270 ) - src += (( framerect. height ( ) - 1 ) * m_bytes_per_pixel ); - - uint leftfill = 0; - uint framefill = 0; - uint rightfill = 0; - uint clipwidth = clip. height ( ) * m_bytes_per_pixel; - - if ( clip. bottom ( ) > framerect. bottom ( )) - leftfill = (( clip. bottom ( ) - framerect. bottom ( )) * m_bytes_per_pixel ) <? clipwidth; - if ( clip. top ( ) < framerect. top ( )) - rightfill = (( framerect. top ( ) - framerect. top ( )) * m_bytes_per_pixel ) <? clipwidth; - - framefill = clipwidth - ( leftfill + rightfill ); - - for ( int y = clip. left ( ); y <= clip. right ( ); y++ ) { - if (( y < framerect. left ( )) || ( y > framerect. right ( ))) { - memset ( dst, 0, clipwidth ); + switch ( rot ) { + case 0: memcpy ( dst + leftfill, src, framefill ); 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; } - else { - if ( leftfill ) - memset ( dst, 0, leftfill ); - - if ( framefill ) { - if ( rot == 90 ) - memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); - else - memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); } @@ -219,3 +176,8 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) dst += m_bytes_per_line_fb; - src += ( rot == 270 ? -m_bytes_per_pixel : m_bytes_per_pixel ); + + 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; } @@ -224,2 +186,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) } + //qWarning ( " ||| painting |||" ); { @@ -233,3 +196,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) } - qWarning( "painting >>>" ); + //qWarning( "painting >>>" ); } |