summaryrefslogtreecommitdiff
authorsandman <sandman>2002-08-02 00:22:01 (UTC)
committer sandman <sandman>2002-08-02 00:22:01 (UTC)
commitca057e02c3bacb8226d5209fcd9aa24009cdb78e (patch) (side-by-side diff)
tree46b4072715ec2f6fcd9affb5f5f3988dba4f3438
parentdae78cce45fb769720874562821d099d979b2c87 (diff)
downloadopie-ca057e02c3bacb8226d5209fcd9aa24009cdb78e.zip
opie-ca057e02c3bacb8226d5209fcd9aa24009cdb78e.tar.gz
opie-ca057e02c3bacb8226d5209fcd9aa24009cdb78e.tar.bz2
Video should work now in QVFB and on the iPAQ with all transformations
(0,90,180 and 270 deg)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp151
1 files changed, 57 insertions, 94 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,4 +124,4 @@ 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 ( )));
+
qt_bug_workaround_clip_rects. resize ( dp. numRects ( ));
@@ -138,88 +131,58 @@ 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 );
-
- if ( rot == 180 )
- src += (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame );
-
- uint leftfill = 0;
- uint framefill = 0;
- uint rightfill = 0;
- uint clipwidth = clip. width ( ) * m_bytes_per_pixel;
-
- 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 ( ))) {
- memset ( dst, 0, clipwidth );
- }
- else {
- if ( leftfill )
- memset ( dst, 0, leftfill );
-
- 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 );
- }
+ uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb );
+ uchar *src = 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;
}
- 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;
+
+ uint leftfill = 0;
+ uint framefill = 0;
+ uint rightfill = 0;
+ uint clipwidth = clip. width ( ) * m_bytes_per_pixel;
+
+ 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 ( ))) {
+ memset ( dst, 0, clipwidth );
+ }
+ else {
+ if ( leftfill )
+ memset ( dst, 0, leftfill );
+
+ if ( framefill ) {
+ 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;
+ }
+ }
+ if ( rightfill )
+ memset ( dst + leftfill + framefill, 0, rightfill );
+ }
- framefill = clipwidth - ( leftfill + rightfill );
+ dst += m_bytes_per_line_fb;
- for ( int y = clip. left ( ); y <= clip. right ( ); y++ ) {
- if (( y < framerect. left ( )) || ( y > framerect. right ( ))) {
- memset ( dst, 0, clipwidth );
- }
- 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 );
- }
- if ( rightfill )
- memset ( dst + leftfill + framefill, 0, rightfill );
- }
-
- 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;
+ }
}
}
- }
+ }
+ //qWarning ( " ||| painting |||" );
{
@@ -227,3 +190,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
QPainter p ( this );
-
+
for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) {
@@ -233,3 +196,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
}
- qWarning( "painting >>>" );
+ //qWarning( "painting >>>" );
}