Diffstat (limited to 'noncore/multimedia/opieplayer2/xinevideowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 81 |
1 files changed, 79 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index e02ee7c..d665f16 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp @@ -4,5 +4,5 @@ Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> - Copyright (c) 2002 L. Potter <ljp@llornkcor.com> + Copyright (c) 2002 LJP <> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. @@ -34,5 +34,10 @@ #include <qimage.h> +#include <qpainter.h> #include <qgfx_qws.h> +#include <qdirectpainter_qws.h> +#include <qsize.h> + +#include <qpe/resource.h> #include "xinevideowidget.h" @@ -45,9 +50,81 @@ XineVideoWidget::XineVideoWidget( int width, { m_image = new QImage( width, height, qt_screen->depth() ); + m_buff = 0; + setBackgroundMode( NoBackground); +/* QImage image = Resource::loadImage("SoundPlayer"); + image = image.smoothScale( width, height ); + + m_image = new QImage( image );*/ } XineVideoWidget::~XineVideoWidget() { delete m_image; } +void XineVideoWidget::clear() { + m_buff = 0; + repaint(); +} void XineVideoWidget::paintEvent( QPaintEvent* e ) { - QWidget::paintEvent( e ); + qWarning("painting"); + QPainter p(this ); + p.setBrush( QBrush( Qt::black ) ); + p.drawRect( rect() ); + if (m_buff == 0 ) + p.drawImage( 0, 0, *m_image ); + else { + qWarning("paitnevent\n"); + + QDirectPainter dp( this ); + uchar* dst = dp.frameBuffer() + (m_yOff + dp.yOffset() ) * linestep + + (m_xOff + dp.xOffset() ) * m_bytes_per_pixel; + uchar* frame = m_buff; + for(int y = 0; y < m_Height; y++ ) { + memcpy( dst, frame, m_bytes ); + frame += m_bytes; + dst += linestep; + } + // QVFB hack by MArtin Jones +// QPainter dp2(this); + // dp2.fillRect( rect(), QBrush( NoBrush ) ); + } +// QWidget::paintEvent( e ); +} +int XineVideoWidget::height() const{ + return m_image->height(); +} +int XineVideoWidget::width() const{ + return m_image->width(); +} +void XineVideoWidget::setImage( QImage* image ) { + delete m_image; + m_image = image; +} +void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, + int xoffsetXBytes, int width, + int height, int linestep, int bytes, int bpp ) { +/* if (m_buff != 0 ) + free(m_buff ); +*/ + m_buff = image; + m_yOff = yoffsetXLine; + m_xOff = xoffsetXBytes; + m_Width = width; + m_Height = height; + this->linestep = linestep; + m_bytes = bytes; + m_bytes_per_pixel = bpp; + //// + qWarning("width %d %d", width, height ); +/* QDirectPainter dp( this ); + uchar* dst = dp.frameBuffer() + (m_yOff + dp.yOffset() ) * linestep + + (m_xOff + dp.xOffset() ) * m_bytes_per_pixel; + uchar* frame = m_buff; + for(int y = 0; y < m_Height; y++ ) { + memcpy( dst, frame, m_bytes ); + frame += m_bytes; + dst += linestep; + } + // QVFB hack + QPainter dp2(this); + dp2.fillRect( rect(), QBrush( NoBrush ) ); +*/ } |