summaryrefslogtreecommitdiff
authorsandman <sandman>2002-12-11 18:35:16 (UTC)
committer sandman <sandman>2002-12-11 18:35:16 (UTC)
commit8ca42b97de03ac84da04b9be84f9bbb8eb17b52d (patch) (side-by-side diff)
tree07e9ed49638eadda2dc475aa965562d199932826
parentb8db7cfea977d20f2d491b0a208a237efb15019a (diff)
downloadopie-8ca42b97de03ac84da04b9be84f9bbb8eb17b52d.zip
opie-8ca42b97de03ac84da04b9be84f9bbb8eb17b52d.tar.gz
opie-8ca42b97de03ac84da04b9be84f9bbb8eb17b52d.tar.bz2
valgrind complained and here are some off-by-1 fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
index 791818e..0833784 100644
--- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp
+++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
@@ -30,51 +30,52 @@
Boston, MA 02111-1307, USA.
*/
#include <qimage.h>
#include <qpainter.h>
#include <qgfx_qws.h>
#include <qdirectpainter_qws.h>
#include <qgfx_qws.h>
#include <qsize.h>
#include <qapplication.h>
#include <qpainter.h>
#include <qpe/resource.h>
#include "xinevideowidget.h"
// 0 deg rot: copy a line from src to dst (use libc memcpy)
// 180 deg rot: copy a line from src to dst reversed
static inline void memcpy_rev ( void *dst, void *src, size_t len )
{
- ((char *) src ) += len;
-
len >>= 1;
+
+ ((char *) src ) += ( len << 1 );
+
while ( len-- )
*((short int *) dst )++ = *--((short int *) src );
}
// 90 deg rot: copy a column from src to dst
static inline void memcpy_step ( void *dst, void *src, size_t len, size_t step )
{
len >>= 1;
while ( len-- ) {
*((short int *) dst )++ = *((short int *) src );
((char *) src ) += step;
}
}
// 270 deg rot: copy a column from src to dst reversed
static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t step )
{
len >>= 1;
((char *) src ) += ( len * step );
while ( len-- ) {
@@ -171,49 +172,49 @@ void XineVideoWidget::paintEvent ( QPaintEvent * )
uint framefill = 0; // "width" of the video frame
uint rightfill = 0; // black border on the "right" side of the video frame
uint clipwidth = clip. width ( ) * m_bytes_per_pixel; // "width" of the current clip rect
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 ( ))) {
// "above" or "below" the video -> black
memset ( dst, 0, clipwidth );
}
else {
if ( leftfill )
memset ( dst, 0, leftfill ); // "left" border -> black
if ( framefill ) { // blit in the video frame
// see above for an explanation of the different memcpys
switch ( rot ) {
- case 0: memcpy ( dst + leftfill, src, framefill ); break;
+ case 0: memcpy ( dst + leftfill, src, framefill & ~1 ); 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;
default: break;
}
}
if ( rightfill )
memset ( dst + leftfill + framefill, 0, rightfill ); // "right" border -> black
}
dst += m_bytes_per_line_fb; // advance one line in the framebuffer
// advance one "line" in the xine frame data
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;
default: break;
}
}
}
}