summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2
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/opieplayer2
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/opieplayer2') (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
@@ -36,6 +36,7 @@
36#include <qpainter.h> 36#include <qpainter.h>
37#include <qgfx_qws.h> 37#include <qgfx_qws.h>
38#include <qdirectpainter_qws.h> 38#include <qdirectpainter_qws.h>
39#include <qgfx_qws.h>
39#include <qsize.h> 40#include <qsize.h>
40 41
41#include <qpe/resource.h> 42#include <qpe/resource.h>
@@ -55,10 +56,6 @@ static inline void memcpy_step ( void *dst, void *src, size_t len, size_t step )
55{ 56{
56 len >>= 1; 57 len >>= 1;
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 );
63 ((char *) src ) += step; 60 ((char *) src ) += step;
64 } 61 }
@@ -73,10 +70,6 @@ static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t st
73 while ( len-- ) { 70 while ( len-- ) {
74 ((char *) src ) -= step; 71 ((char *) src ) -= step;
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 }
81} 74}
82 75
@@ -109,12 +102,12 @@ void XineVideoWidget::clear ( )
109 102
110void XineVideoWidget::paintEvent ( QPaintEvent * ) 103void XineVideoWidget::paintEvent ( QPaintEvent * )
111{ 104{
112 qWarning( "painting <<<" ); 105 //qWarning( "painting <<<" );
113 if ( m_buff == 0 ) { 106 if ( m_buff == 0 ) {
114 QPainter p ( this ); 107 QPainter p ( this );
115 p. fillRect ( rect ( ), black ); 108 p. fillRect ( rect ( ), black );
116 p. drawImage ( 0, 0, *m_image ); 109 p. drawImage ( 0, 0, *m_image );
117 qWarning ( "logo\n" ); 110 //qWarning ( "logo\n" );
118 } 111 }
119 else { 112 else {
120 // qWarning ( "paintevent\n" ); 113 // qWarning ( "paintevent\n" );
@@ -129,21 +122,24 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
129 uchar *fb = dp. frameBuffer ( ); 122 uchar *fb = dp. frameBuffer ( );
130 uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame; 123 uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame;
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
134 qt_bug_workaround_clip_rects. resize ( dp. numRects ( )); 127 qt_bug_workaround_clip_rects. resize ( dp. numRects ( ));
135 128
136 for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) { 129 for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) {
137 const QRect &clip = dp. rect ( i ); 130 const QRect &clip = dp. rect ( i );
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
148 uint leftfill = 0; 144 uint leftfill = 0;
149 uint framefill = 0; 145 uint framefill = 0;
@@ -166,62 +162,29 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
166 memset ( dst, 0, leftfill ); 162 memset ( dst, 0, leftfill );
167 163
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 }
215 if ( rightfill ) 172 if ( rightfill )
216 memset ( dst + leftfill + framefill, 0, rightfill ); 173 memset ( dst + leftfill + framefill, 0, rightfill );
217 } 174 }
218 175
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 }
222 } 184 }
223 } 185 }
224 } 186 }
187 //qWarning ( " ||| painting |||" );
225 { 188 {
226 // QVFB hack by MArtin Jones 189 // QVFB hack by MArtin Jones
227 QPainter p ( this ); 190 QPainter p ( this );
@@ -231,7 +194,7 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
231 } 194 }
232 } 195 }
233 } 196 }
234 qWarning( "painting >>>" ); 197 //qWarning( "painting >>>" );
235} 198}
236 199
237int XineVideoWidget::height ( ) const 200int XineVideoWidget::height ( ) const