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
@@ -1,18 +1,18 @@
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
13:`=1 )Y*s>-.--   : the terms of the GNU General Public 13:`=1 )Y*s>-.--   : the terms of the GNU General Public
14.="- .-=="i,     .._ License as published by the Free Software 14.="- .-=="i,     .._ License as published by the Free Software
15 - .   .-<_>     .<> Foundation; either version 2 of the License, 15 - .   .-<_>     .<> Foundation; either version 2 of the License,
16     ._= =}       : or (at your option) any later version. 16     ._= =}       : or (at your option) any later version.
17    .%`+i>       _;_. 17    .%`+i>       _;_.
18    .i_,=:_.      -<s. This program is distributed in the hope that 18    .i_,=:_.      -<s. This program is distributed in the hope that
@@ -24,30 +24,107 @@
24++=   -.     .`     .: details. 24++=   -.     .`     .: details.
25 :     =  ...= . :.=- 25 :     =  ...= . :.=-
26 -.   .:....=;==+<; You should have received a copy of the GNU 26 -.   .:....=;==+<; You should have received a copy of the GNU
27  -_. . .   )=.  = Library General Public License along with 27  -_. . .   )=.  = Library General Public License along with
28    --        :-=` this library; see the file COPYING.LIB. 28    --        :-=` this library; see the file COPYING.LIB.
29 If not, write to the Free Software Foundation, 29 If not, write to the Free Software Foundation,
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
40XineVideoWidget::XineVideoWidget( int width, 45XineVideoWidget::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}
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}