Diffstat (limited to 'noncore/multimedia/opieplayer2/xinevideowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/xinevideowidget.cpp | 61 |
1 files changed, 28 insertions, 33 deletions
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp index d665f16..b5a714e 100644 --- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp +++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp | |||
@@ -43,13 +43,13 @@ | |||
43 | #include "xinevideowidget.h" | 43 | #include "xinevideowidget.h" |
44 | 44 | ||
45 | XineVideoWidget::XineVideoWidget( int width, | 45 | XineVideoWidget::XineVideoWidget( int width, |
46 | int height, | 46 | int height, |
47 | QWidget* parent, | 47 | QWidget* parent, |
48 | const char* name ) | 48 | const char* name ) |
49 | : QWidget( parent, name ) | 49 | : QWidget( parent, name, WRepaintNoErase | WResizeNoErase ) |
50 | { | 50 | { |
51 | m_image = new QImage( width, height, qt_screen->depth() ); | 51 | m_image = new QImage( width, height, qt_screen->depth() ); |
52 | m_buff = 0; | 52 | m_buff = 0; |
53 | setBackgroundMode( NoBackground); | 53 | setBackgroundMode( NoBackground); |
54 | /* QImage image = Resource::loadImage("SoundPlayer"); | 54 | /* QImage image = Resource::loadImage("SoundPlayer"); |
55 | image = image.smoothScale( width, height ); | 55 | image = image.smoothScale( width, height ); |
@@ -58,38 +58,49 @@ XineVideoWidget::XineVideoWidget( int width, | |||
58 | } | 58 | } |
59 | XineVideoWidget::~XineVideoWidget() { | 59 | XineVideoWidget::~XineVideoWidget() { |
60 | delete m_image; | 60 | delete m_image; |
61 | } | 61 | } |
62 | void XineVideoWidget::clear() { | 62 | void XineVideoWidget::clear() { |
63 | m_buff = 0; | 63 | m_buff = 0; |
64 | repaint(); | 64 | repaint(false); |
65 | } | 65 | } |
66 | void XineVideoWidget::paintEvent( QPaintEvent* e ) { | 66 | void XineVideoWidget::paintEvent( QPaintEvent* e ) { |
67 | qWarning("painting"); | 67 | qWarning("painting"); |
68 | if (m_buff == 0 ) { | ||
68 | QPainter p(this ); | 69 | QPainter p(this ); |
69 | p.setBrush( QBrush( Qt::black ) ); | 70 | p.fillRect( rect(), black ); |
70 | p.drawRect( rect() ); | ||
71 | if (m_buff == 0 ) | ||
72 | p.drawImage( 0, 0, *m_image ); | 71 | p.drawImage( 0, 0, *m_image ); |
72 | qWarning ( "logo\n" ); | ||
73 | } | ||
73 | else { | 74 | else { |
74 | qWarning("paitnevent\n"); | 75 | qWarning("paitnevent\n"); |
76 | { | ||
75 | 77 | ||
78 | if (( m_thisframe & m_lastframe ) != m_lastframe ) { | ||
79 | QPainter p ( this ); | ||
80 | p. fillRect ( m_lastframe, black ); | ||
81 | } | ||
82 | } | ||
83 | { | ||
76 | QDirectPainter dp( this ); | 84 | QDirectPainter dp( this ); |
77 | uchar* dst = dp.frameBuffer() + (m_yOff + dp.yOffset() ) * linestep + | 85 | |
78 | (m_xOff + dp.xOffset() ) * m_bytes_per_pixel; | 86 | uchar* dst = dp.frameBuffer() + (m_thisframe. y ( ) + dp.yOffset() ) * linestep + |
87 | (m_thisframe. x ( ) + dp.xOffset() ) * m_bytes_per_pixel; | ||
79 | uchar* frame = m_buff; | 88 | uchar* frame = m_buff; |
80 | for(int y = 0; y < m_Height; y++ ) { | 89 | for(int y = 0; y < m_thisframe. height ( ); y++ ) { |
81 | memcpy( dst, frame, m_bytes ); | 90 | memcpy( dst, frame, m_bytes ); |
82 | frame += m_bytes; | 91 | frame += m_bytes; |
83 | dst += linestep; | 92 | dst += linestep; |
84 | } | 93 | } |
94 | } | ||
95 | { | ||
85 | // QVFB hack by MArtin Jones | 96 | // QVFB hack by MArtin Jones |
86 | // QPainter dp2(this); | 97 | QPainter p ( this ); |
87 | // dp2.fillRect( rect(), QBrush( NoBrush ) ); | 98 | p. fillRect ( m_thisframe, QBrush ( NoBrush )); |
99 | } | ||
88 | } | 100 | } |
89 | // QWidget::paintEvent( e ); | ||
90 | } | 101 | } |
91 | int XineVideoWidget::height() const{ | 102 | int XineVideoWidget::height() const{ |
92 | return m_image->height(); | 103 | return m_image->height(); |
93 | } | 104 | } |
94 | int XineVideoWidget::width() const{ | 105 | int XineVideoWidget::width() const{ |
95 | return m_image->width(); | 106 | return m_image->width(); |
@@ -98,33 +109,17 @@ void XineVideoWidget::setImage( QImage* image ) { | |||
98 | delete m_image; | 109 | delete m_image; |
99 | m_image = image; | 110 | m_image = image; |
100 | } | 111 | } |
101 | void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, | 112 | void XineVideoWidget::setImage( uchar* image, int yoffsetXLine, |
102 | int xoffsetXBytes, int width, | 113 | int xoffsetXBytes, int width, |
103 | int height, int linestep, int bytes, int bpp ) { | 114 | int height, int linestep, int bytes, int bpp ) { |
104 | /* if (m_buff != 0 ) | 115 | |
105 | free(m_buff ); | 116 | m_lastframe = m_thisframe; |
106 | */ | 117 | m_thisframe. setRect ( xoffsetXBytes, yoffsetXLine, width, height ); |
118 | |||
107 | m_buff = image; | 119 | m_buff = image; |
108 | m_yOff = yoffsetXLine; | ||
109 | m_xOff = xoffsetXBytes; | ||
110 | m_Width = width; | ||
111 | m_Height = height; | ||
112 | this->linestep = linestep; | 120 | this->linestep = linestep; |
113 | m_bytes = bytes; | 121 | m_bytes = bytes; |
114 | m_bytes_per_pixel = bpp; | 122 | m_bytes_per_pixel = bpp; |
115 | //// | 123 | |
116 | qWarning("width %d %d", width, height ); | 124 | repaint ( false ); |
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 | */ | ||
130 | } | 125 | } |