summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/xinevideowidget.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/xinevideowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp81
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
@@ -3,7 +3,7 @@
3                This file is part of the Opie Project 3                This file is part of the Opie Project
4 4
5              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 5              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
6 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 6 Copyright (c) 2002 LJP <>
7 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 7 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
8 =. 8 =.
9 .=l. 9 .=l.
@@ -33,7 +33,12 @@
33*/ 33*/
34 34
35#include <qimage.h> 35#include <qimage.h>
36#include <qpainter.h>
36#include <qgfx_qws.h> 37#include <qgfx_qws.h>
38#include <qdirectpainter_qws.h>
39#include <qsize.h>
40
41#include <qpe/resource.h>
37 42
38#include "xinevideowidget.h" 43#include "xinevideowidget.h"
39 44
@@ -44,10 +49,82 @@ XineVideoWidget::XineVideoWidget( int width,
44 : QWidget( parent, name ) 49 : QWidget( parent, name )
45{ 50{
46 m_image = new QImage( width, height, qt_screen->depth() ); 51 m_image = new QImage( width, height, qt_screen->depth() );
52 m_buff = 0;
53 setBackgroundMode( NoBackground);
54/* QImage image = Resource::loadImage("SoundPlayer");
55 image = image.smoothScale( width, height );
56
57 m_image = new QImage( image );*/
47} 58}
48XineVideoWidget::~XineVideoWidget() { 59XineVideoWidget::~XineVideoWidget() {
49 delete m_image; 60 delete m_image;
50} 61}
62void XineVideoWidget::clear() {
63 m_buff = 0;
64 repaint();
65}
51void XineVideoWidget::paintEvent( QPaintEvent* e ) { 66void XineVideoWidget::paintEvent( QPaintEvent* e ) {
52 QWidget::paintEvent( e ); 67 qWarning("painting");
68 QPainter p(this );
69 p.setBrush( QBrush( Qt::black ) );
70 p.drawRect( rect() );
71 if (m_buff == 0 )
72 p.drawImage( 0, 0, *m_image );
73 else {
74 qWarning("paitnevent\n");
75
76 QDirectPainter dp( this );
77 uchar* dst = dp.frameBuffer() + (m_yOff + dp.yOffset() ) * linestep +
78 (m_xOff + dp.xOffset() ) * m_bytes_per_pixel;
79 uchar* frame = m_buff;
80 for(int y = 0; y < m_Height; y++ ) {
81 memcpy( dst, frame, m_bytes );
82 frame += m_bytes;
83 dst += linestep;
84 }
85 // QVFB hack by MArtin Jones
86// QPainter dp2(this);
87 // dp2.fillRect( rect(), QBrush( NoBrush ) );
88 }
89// QWidget::paintEvent( e );
90}
91int XineVideoWidget::height() const{
92 return m_image->height();
93}
94int XineVideoWidget::width() const{
95 return m_image->width();
96}
97void XineVideoWidget::setImage( QImage* image ) {
98 delete m_image;
99 m_image = image;
100}
101void XineVideoWidget::setImage( uchar* image, int yoffsetXLine,
102 int xoffsetXBytes, int width,
103 int height, int linestep, int bytes, int bpp ) {
104/* if (m_buff != 0 )
105 free(m_buff );
106*/
107 m_buff = image;
108 m_yOff = yoffsetXLine;
109 m_xOff = xoffsetXBytes;
110 m_Width = width;
111 m_Height = height;
112 this->linestep = linestep;
113 m_bytes = bytes;
114 m_bytes_per_pixel = bpp;
115 ////
116 qWarning("width %d %d", width, height );
117/* QDirectPainter dp( this );
118 uchar* dst = dp.frameBuffer() + (m_yOff + dp.yOffset() ) * linestep +
119 (m_xOff + dp.xOffset() ) * m_bytes_per_pixel;
120 uchar* frame = m_buff;
121 for(int y = 0; y < m_Height; y++ ) {
122 memcpy( dst, frame, m_bytes );
123 frame += m_bytes;
124 dst += linestep;
125 }
126 // QVFB hack
127 QPainter dp2(this);
128 dp2.fillRect( rect(), QBrush( NoBrush ) );
129*/
53} 130}