-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index 7f59085..78ebe19 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp | |||
@@ -1,13 +1,12 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
4 | 3 | ||
5 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
6 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
7 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
8 | =. | 7 | =. |
9 | .=l. | 8 | .=l. |
10 | .>+-= | 9 | .>+-= |
11 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
12 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
13 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
@@ -206,42 +205,47 @@ void XineVideoWidget::paintEvent2 ( QPaintEvent * ) | |||
206 | _vh = m_framesize.width(); | 205 | _vh = m_framesize.width(); |
207 | _vw = m_framesize.height(); | 206 | _vw = m_framesize.height(); |
208 | break; | 207 | break; |
209 | default: | 208 | default: |
210 | _vw = m_framesize.width(); | 209 | _vw = m_framesize.width(); |
211 | _vh = m_framesize.height(); | 210 | _vh = m_framesize.height(); |
212 | break; | 211 | break; |
213 | break; | 212 | break; |
214 | } | 213 | } |
215 | int middle_w = _vw/2; | 214 | int middle_w = _vw/2; |
216 | int middle_h = _vh/2; | 215 | int middle_h = _vh/2; |
217 | m_thisframe.setRect(width()/2-middle_w,height()/2-middle_h,_vw,_vh); | 216 | m_thisframe.setRect(width()/2-middle_w,height()/2-middle_h,_vw,_vh); |
217 | |||
218 | { | ||
219 | // is this stuff realy needed? it seems working without, too. | ||
218 | QRect topFill,rightFill,leftFill,downFill; | 220 | QRect topFill,rightFill,leftFill,downFill; |
219 | topFill. setRect(0,0 ,width(),m_thisframe.top()); | 221 | topFill. setRect(0,0 ,width(),m_thisframe.top()); |
220 | downFill.setCoords(0,m_thisframe.bottom(),width(),height()); | 222 | downFill.setCoords(0,m_thisframe.bottom(),width(),height()); |
221 | rightFill.setCoords(m_thisframe.right(),0,width(),height()); | 223 | rightFill.setCoords(m_thisframe.right(),0,width(),height()); |
222 | leftFill.setCoords(0,0,m_thisframe.left(),height()); | 224 | leftFill.setCoords(0,0,m_thisframe.left(),height()); |
223 | 225 | ||
224 | if (topFill.isValid()) { | 226 | if (topFill.isValid()) { |
225 | p.fillRect(topFill,black); | 227 | p.fillRect(topFill,black); |
226 | } | 228 | } |
227 | if (downFill.isValid()) { | 229 | if (downFill.isValid()) { |
228 | p.fillRect(downFill,black); | 230 | p.fillRect(downFill,black); |
229 | } | 231 | } |
230 | if (rightFill.isValid()) { | 232 | if (rightFill.isValid()) { |
231 | p.fillRect(rightFill,black); | 233 | p.fillRect(rightFill,black); |
232 | } | 234 | } |
233 | if (leftFill.isValid()) { | 235 | if (leftFill.isValid()) { |
234 | p.fillRect(leftFill,black); | 236 | p.fillRect(leftFill,black); |
235 | } | 237 | } |
238 | |||
239 | } | ||
236 | uchar *fb = dp. frameBuffer ( ); | 240 | uchar *fb = dp. frameBuffer ( ); |
237 | uchar *frame = m_buff; | 241 | uchar *frame = m_buff; |
238 | 242 | ||
239 | // where is the video frame in fb coordinates | 243 | // where is the video frame in fb coordinates |
240 | QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), | 244 | QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), |
241 | qt_screen-> height ( ))); | 245 | qt_screen-> height ( ))); |
242 | 246 | ||
243 | uchar * src = frame; | 247 | uchar * src = frame; |
244 | uchar * dst = fb+framerect.y()*m_bytes_per_line_fb+framerect.x()*m_bytes_per_pixel; | 248 | uchar * dst = fb+framerect.y()*m_bytes_per_line_fb+framerect.x()*m_bytes_per_pixel; |
245 | 249 | ||
246 | for (int y=framerect.top();y<=framerect.bottom();++y) { | 250 | for (int y=framerect.top();y<=framerect.bottom();++y) { |
247 | switch (rot) { | 251 | switch (rot) { |
@@ -258,31 +262,24 @@ void XineVideoWidget::paintEvent2 ( QPaintEvent * ) | |||
258 | src-=m_bytes_per_line_frame; | 262 | src-=m_bytes_per_line_frame; |
259 | break; | 263 | break; |
260 | case 3: | 264 | case 3: |
261 | memcpy_step_rev ( dst, src, m_thisframe.size().width(), m_bytes_per_line_frame ); | 265 | memcpy_step_rev ( dst, src, m_thisframe.size().width(), m_bytes_per_line_frame ); |
262 | src += m_bytes_per_pixel; | 266 | src += m_bytes_per_pixel; |
263 | break; | 267 | break; |
264 | default: | 268 | default: |
265 | break; | 269 | break; |
266 | } | 270 | } |
267 | dst += m_bytes_per_line_fb; | 271 | dst += m_bytes_per_line_fb; |
268 | } | 272 | } |
269 | } | 273 | } |
270 | |||
271 | |||
272 | { | ||
273 | // QVFB hack by Martin Jones | ||
274 | // We need to "touch" all affected clip rects with a normal QPainter in addition to the QDirectPainter | ||
275 | p.fillRect(QRect(mapFromGlobal (m_thisframe. topLeft ( )), m_thisframe.size ()),QBrush(NoBrush)); | ||
276 | } | ||
277 | } | 274 | } |
278 | } | 275 | } |
279 | 276 | ||
280 | QImage *XineVideoWidget::logo ( ) const | 277 | QImage *XineVideoWidget::logo ( ) const |
281 | { | 278 | { |
282 | return m_logo; | 279 | return m_logo; |
283 | } | 280 | } |
284 | 281 | ||
285 | 282 | ||
286 | void XineVideoWidget::setLogo ( QImage* logo ) | 283 | void XineVideoWidget::setLogo ( QImage* logo ) |
287 | { | 284 | { |
288 | delete m_logo; | 285 | delete m_logo; |
@@ -302,37 +299,34 @@ void XineVideoWidget::setVideoFrame ( uchar* img, int w, int h, int bpl ) | |||
302 | int l = h*bpl; | 299 | int l = h*bpl; |
303 | if (l!=m_lastsize) { | 300 | if (l!=m_lastsize) { |
304 | if (m_buff) { | 301 | if (m_buff) { |
305 | delete[]m_buff; | 302 | delete[]m_buff; |
306 | } | 303 | } |
307 | if (l>0) { | 304 | if (l>0) { |
308 | m_buff = new uchar[l]; | 305 | m_buff = new uchar[l]; |
309 | odebug << "Point to: " << (unsigned long)m_buff << oendl; | 306 | odebug << "Point to: " << (unsigned long)m_buff << oendl; |
310 | m_lastsize=l; | 307 | m_lastsize=l; |
311 | } else { | 308 | } else { |
312 | m_buff = 0; | 309 | m_buff = 0; |
313 | } | 310 | } |
314 | } else if (l==0){ | ||
315 | delete[] m_buff; | ||
316 | m_buff = 0; | ||
317 | } | 311 | } |
318 | m_lastsize = l; | 312 | m_lastsize = l; |
319 | m_framesize = QSize(w,h); | 313 | m_framesize = QSize(w,h); |
320 | if (m_buff && m_lastsize) { | 314 | if (m_buff && m_lastsize) { |
321 | memcpy(m_buff,img,m_lastsize); | 315 | memcpy(m_buff,img,m_lastsize); |
322 | } | 316 | } |
323 | m_bytes_per_line_frame = bpl; | 317 | m_bytes_per_line_frame = bpl; |
324 | } // Release Mutex | 318 | } // Release Mutex |
325 | 319 | ||
326 | paintEvent2(0); | 320 | if (m_buff) paintEvent2(0); |
327 | } | 321 | } |
328 | 322 | ||
329 | void XineVideoWidget::resizeEvent ( QResizeEvent * ) | 323 | void XineVideoWidget::resizeEvent ( QResizeEvent * ) |
330 | { | 324 | { |
331 | emit videoResized( videoSize() ); | 325 | emit videoResized( videoSize() ); |
332 | } | 326 | } |
333 | 327 | ||
334 | 328 | ||
335 | void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ ) | 329 | void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ ) |
336 | { | 330 | { |
337 | emit clicked(); | 331 | emit clicked(); |
338 | } | 332 | } |