summaryrefslogtreecommitdiff
path: root/noncore/multimedia
authorsandman <sandman>2002-08-02 00:22:01 (UTC)
committer sandman <sandman>2002-08-02 00:22:01 (UTC)
commitca057e02c3bacb8226d5209fcd9aa24009cdb78e (patch) (unidiff)
tree46b4072715ec2f6fcd9affb5f5f3988dba4f3438 /noncore/multimedia
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 (limited to 'noncore/multimedia') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp87
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 @@
38#include <qdirectpainter_qws.h> 38#include <qdirectpainter_qws.h>
39#include <qgfx_qws.h>
39#include <qsize.h> 40#include <qsize.h>
@@ -57,6 +58,2 @@ static inline void memcpy_step ( void *dst, void *src, size_t len, size_t step )
57 while ( len-- ) { 58 while ( len-- ) {
58 // *((char *) dst ) = *((char *) src + 1);
59 // *((char *) dst + 1) = *((char *) src );
60 // ((char *) dst ) += 2;
61
62 *((short int *) dst )++ = *((short int *) src ); 59 *((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
75 *((short int *) dst )++ = *((short int *) src ); 72 *((short int *) dst )++ = *((short int *) src );
76
77 // *((char *) dst ) = *((char *) src + 1);
78 // *((char *) dst + 1) = *((char *) src );
79 // ((char *) dst ) += 2;
80 } 73 }
@@ -111,3 +104,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
111{ 104{
112 qWarning( "painting <<<" ); 105 //qWarning( "painting <<<" );
113 if ( m_buff == 0 ) { 106 if ( m_buff == 0 ) {
@@ -116,3 +109,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
116 p. drawImage ( 0, 0, *m_image ); 109 p. drawImage ( 0, 0, *m_image );
117 qWarning ( "logo\n" ); 110 //qWarning ( "logo\n" );
118 } 111 }
@@ -131,3 +124,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
131 124
132 QRect framerect = QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )); 125 QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
133 126
@@ -138,10 +131,13 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
138 131
139 qt_bug_workaround_clip_rects [i] = clip; 132 qt_bug_workaround_clip_rects [i] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
140 133
141 if ( rot == 0 || rot == 180 ) {
142 uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb ); 134 uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb );
143 uchar *src = frame + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ); 135 uchar *src = frame;
144 136
145 if ( rot == 180 ) 137 switch ( rot ) {
146 src += (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame ); 138 case 0: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) ); break;
139 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;
140 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;
141 case 3: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) ); break;
142 }
147 143
@@ -168,47 +164,8 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
168 if ( framefill ) { 164 if ( framefill ) {
169 if ( rot == 0 ) 165 switch ( rot ) {
170 memcpy ( dst + leftfill, src, framefill ); 166 case 0: memcpy ( dst + leftfill, src, framefill ); break;
171 else 167 case 1: memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
172 memcpy_rev ( dst + leftfill, src, framefill ); 168 case 2: memcpy_rev ( dst + leftfill, src, framefill ); break;
173 } 169 case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
174 if ( rightfill )
175 memset ( dst + leftfill + framefill, 0, rightfill );
176 }
177
178 dst += m_bytes_per_line_fb;
179 src += ( rot == 0 ? m_bytes_per_line_frame : -m_bytes_per_line_frame );
180 }
181 }
182 else { // rot == 90 || rot == 270
183 uchar *dst = fb + ( clip. y ( ) * m_bytes_per_pixel ) + ( clip. x ( ) * m_bytes_per_line_fb );
184 uchar *src = frame + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame );
185
186 if ( rot == 270 )
187 src += (( framerect. height ( ) - 1 ) * m_bytes_per_pixel );
188
189 uint leftfill = 0;
190 uint framefill = 0;
191 uint rightfill = 0;
192 uint clipwidth = clip. height ( ) * m_bytes_per_pixel;
193
194 if ( clip. bottom ( ) > framerect. bottom ( ))
195 leftfill = (( clip. bottom ( ) - framerect. bottom ( )) * m_bytes_per_pixel ) <? clipwidth;
196 if ( clip. top ( ) < framerect. top ( ))
197 rightfill = (( framerect. top ( ) - framerect. top ( )) * m_bytes_per_pixel ) <? clipwidth;
198
199 framefill = clipwidth - ( leftfill + rightfill );
200
201 for ( int y = clip. left ( ); y <= clip. right ( ); y++ ) {
202 if (( y < framerect. left ( )) || ( y > framerect. right ( ))) {
203 memset ( dst, 0, clipwidth );
204 } 170 }
205 else {
206 if ( leftfill )
207 memset ( dst, 0, leftfill );
208
209 if ( framefill ) {
210 if ( rot == 90 )
211 memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame );
212 else
213 memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame );
214 } 171 }
@@ -219,3 +176,8 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
219 dst += m_bytes_per_line_fb; 176 dst += m_bytes_per_line_fb;
220 src += ( rot == 270 ? -m_bytes_per_pixel : m_bytes_per_pixel ); 177
178 switch ( rot ) {
179 case 0: src += m_bytes_per_line_frame; break;
180 case 1: src -= m_bytes_per_pixel; break;
181 case 2: src -= m_bytes_per_line_frame; break;
182 case 3: src += m_bytes_per_pixel; break;
221 } 183 }
@@ -224,2 +186,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
224 } 186 }
187 //qWarning ( " ||| painting |||" );
225 { 188 {
@@ -233,3 +196,3 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
233 } 196 }
234 qWarning( "painting >>>" ); 197 //qWarning( "painting >>>" );
235} 198}