Diffstat (limited to 'noncore/multimedia/opieplayer2/xinevideowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index 9b26d41..1d88cea 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp | |||
@@ -44,6 +44,7 @@ | |||
44 | 44 | ||
45 | #include "xinevideowidget.h" | 45 | #include "xinevideowidget.h" |
46 | 46 | ||
47 | |||
47 | // 0 deg rot: copy a line from src to dst (use libc memcpy) | 48 | // 0 deg rot: copy a line from src to dst (use libc memcpy) |
48 | 49 | ||
49 | // 180 deg rot: copy a line from src to dst reversed | 50 | // 180 deg rot: copy a line from src to dst reversed |
@@ -59,25 +60,25 @@ static inline void memcpy_rev ( void *dst, void *src, size_t len ) | |||
59 | 60 | ||
60 | // 90 deg rot: copy a column from src to dst | 61 | // 90 deg rot: copy a column from src to dst |
61 | 62 | ||
62 | static inline void memcpy_step ( void *dst, void *src, size_t len, size_t linestep ) | 63 | static inline void memcpy_step ( void *dst, void *src, size_t len, size_t step ) |
63 | { | 64 | { |
64 | len >>= 1; | 65 | len >>= 1; |
65 | while ( len-- ) { | 66 | while ( len-- ) { |
66 | *((short int *) dst) ++ = *((short int *) src); | 67 | *((short int *) dst) ++ = *((short int *) src); |
67 | ((char * ) src) += linestep; | 68 | ((char *) src ) += step; |
68 | } | 69 | } |
69 | } | 70 | } |
70 | 71 | ||
71 | // 270 deg rot: copy a column from src to dst reversed | 72 | // 270 deg rot: copy a column from src to dst reversed |
72 | 73 | ||
73 | static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t linestep ) | 74 | static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t step ) |
74 | { | 75 | { |
75 | len >>= 1; | 76 | len >>= 1; |
76 | 77 | ||
77 | ((char *) src) += ( len * linestep ); | 78 | ((char *) src ) += ( len * step ); |
78 | 79 | ||
79 | while ( len-- ) { | 80 | while ( len-- ) { |
80 | ((char *) src) -= linestep; | 81 | ((char *) src ) -= step; |
81 | *((short int *) dst) ++ = *((short int *) src); | 82 | *((short int *) dst) ++ = *((short int *) src); |
82 | } | 83 | } |
83 | } | 84 | } |
@@ -182,6 +183,7 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) | |||
182 | case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break; | 183 | case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break; |
183 | default: break; | 184 | default: break; |
184 | } | 185 | } |
186 | } | ||
185 | if ( rightfill ) | 187 | if ( rightfill ) |
186 | memset ( dst + leftfill + framefill, 0, rightfill ); // "right" border -> black | 188 | memset ( dst + leftfill + framefill, 0, rightfill ); // "right" border -> black |
187 | } | 189 | } |
@@ -198,6 +200,7 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) | |||
198 | } | 200 | } |
199 | } | 201 | } |
200 | } | 202 | } |
203 | } | ||
201 | 204 | ||
202 | { | 205 | { |
203 | // QVFB hack by Martin Jones | 206 | // QVFB hack by Martin Jones |
@@ -212,16 +215,21 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) | |||
212 | } | 215 | } |
213 | } | 216 | } |
214 | 217 | ||
215 | QImage *XineVideoWidget::logo ( ) const { | 218 | |
219 | QImage *XineVideoWidget::logo ( ) const | ||
220 | { | ||
216 | return m_logo; | 221 | return m_logo; |
217 | } | 222 | } |
218 | 223 | ||
219 | void XineVideoWidget::setLogo ( QImage * image ) { | 224 | |
225 | void XineVideoWidget::setLogo ( QImage* logo ) | ||
226 | { | ||
220 | delete m_logo; | 227 | delete m_logo; |
221 | m_logo = image; | 228 | m_logo = logo; |
222 | } | 229 | } |
223 | 230 | ||
224 | void XineVideoWidget::setVideoFrame ( uchar * img, int w, int h, int bpl ) { | 231 | void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl ) |
232 | { | ||
225 | bool rot90 = (( -m_rotation ) & 1 ); | 233 | bool rot90 = (( -m_rotation ) & 1 ); |
226 | 234 | ||
227 | if ( rot90 ) { // if the rotation is 90 or 270 we have to swap width / height | 235 | if ( rot90 ) { // if the rotation is 90 or 270 we have to swap width / height |
@@ -238,16 +246,16 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) | |||
238 | 246 | ||
239 | // only repaint the area that *really* needs to be repainted | 247 | // only repaint the area that *really* needs to be repainted |
240 | 248 | ||
241 | repaint (( | 249 | repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false ); |
242 | } | 250 | } |
243 | 251 | ||
244 | void XineVideoWidget::resizeEvent ( QResizeEvent * ) { | 252 | void XineVideoWidget::resizeEvent ( QResizeEvent * ) |
253 | { | ||
245 | QSize s = size ( ); | 254 | QSize s = size ( ); |
246 | bool fs = ( s == qApp-> desktop ( ) -> size ( )); | 255 | bool fs = ( s == qApp-> desktop ( ) -> size ( )); |
247 | 256 | ||
248 | // if we are in fullscreen mode, do not rotate the video | 257 | // if we are in fullscreen mode, do not rotate the video |
249 | // (!! the paint routine uses m_rotation + qt_screen-> transformOrientation() !!) | 258 | // (!! the paint routine uses m_rotation + qt_screen-> transformOrientation() !!) |
250 | |||
251 | m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0; | 259 | m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0; |
252 | 260 | ||
253 | if ( fs && qt_screen-> isTransformed ( )) | 261 | if ( fs && qt_screen-> isTransformed ( )) |
@@ -257,7 +265,8 @@ void XineVideoWidget::paintEvent ( QPaintEvent * ) | |||
257 | } | 265 | } |
258 | 266 | ||
259 | 267 | ||
260 | void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * ) { | 268 | void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ ) |
269 | { | ||
261 | emit clicked ( ); | 270 | emit clicked ( ); |
262 | } | 271 | } |
263 | 272 | ||