author | zecke <zecke> | 2002-07-11 22:44:54 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-07-11 22:44:54 (UTC) |
commit | d2c7228d2efe6f47ef5b7ec04157fcead775be74 (patch) (side-by-side diff) | |
tree | 95584eff5b953cc4ac908da028ef3c66c75b28cd /noncore/multimedia/opieplayer2/xinevideowidget.cpp | |
parent | 1651f048bb129b8e748a01c514d84c8626e0f1e2 (diff) | |
download | opie-d2c7228d2efe6f47ef5b7ec04157fcead775be74.zip opie-d2c7228d2efe6f47ef5b7ec04157fcead775be74.tar.gz opie-d2c7228d2efe6f47ef5b7ec04157fcead775be74.tar.bz2 |
broken video widget
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 @@ -1,12 +1,12 @@ /* This file is part of the Opie Project 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> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under @@ -30,24 +30,101 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qimage.h> +#include <qpainter.h> #include <qgfx_qws.h> +#include <qdirectpainter_qws.h> +#include <qsize.h> + +#include <qpe/resource.h> #include "xinevideowidget.h" XineVideoWidget::XineVideoWidget( int width, int height, QWidget* parent, const char* name ) : QWidget( parent, name ) { 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 ) ); +*/ } |