author | zecke <zecke> | 2002-07-11 22:44:54 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-07-11 22:44:54 (UTC) |
commit | d2c7228d2efe6f47ef5b7ec04157fcead775be74 (patch) (unidiff) | |
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 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
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. |
10 | .>+-= | 10 | .>+-= |
11 | _;:, .> :=|. This program is free software; you can | 11 | _;:, .> :=|. This program is free software; you can |
12 | .> <`_, > . <= redistribute it and/or modify it under | 12 | .> <`_, > . <= redistribute it and/or modify it under |
@@ -30,24 +30,101 @@ | |||
30 | Inc., 59 Temple Place - Suite 330, | 30 | Inc., 59 Temple Place - Suite 330, |
31 | Boston, MA 02111-1307, USA. | 31 | Boston, MA 02111-1307, USA. |
32 | 32 | ||
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 | ||
40 | XineVideoWidget::XineVideoWidget( int width, | 45 | XineVideoWidget::XineVideoWidget( int width, |
41 | int height, | 46 | int height, |
42 | QWidget* parent, | 47 | QWidget* parent, |
43 | const char* name ) | 48 | const char* name ) |
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 | } |
48 | XineVideoWidget::~XineVideoWidget() { | 59 | XineVideoWidget::~XineVideoWidget() { |
49 | delete m_image; | 60 | delete m_image; |
50 | } | 61 | } |
62 | void XineVideoWidget::clear() { | ||
63 | m_buff = 0; | ||
64 | repaint(); | ||
65 | } | ||
51 | void XineVideoWidget::paintEvent( QPaintEvent* e ) { | 66 | void 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 | } | ||
91 | int XineVideoWidget::height() const{ | ||
92 | return m_image->height(); | ||
93 | } | ||
94 | int XineVideoWidget::width() const{ | ||
95 | return m_image->width(); | ||
96 | } | ||
97 | void XineVideoWidget::setImage( QImage* image ) { | ||
98 | delete m_image; | ||
99 | m_image = image; | ||
100 | } | ||
101 | void 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 | } |