[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src/analyzers
From: Mark Kretschmann <markey () web ! de>
Date: 2007-04-12 16:53:58
Message-ID: 1176396839.000033.3833.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 653110 by markey:
Port drawing code to Qt4; visual improvements.
M +10 -28 baranalyzer.cpp
M +0 -1 baranalyzer.h
--- trunk/extragear/multimedia/amarok/src/analyzers/baranalyzer.cpp #653109:653110
@@ -80,7 +80,6 @@
}
m_pixBarGradient.resize( height()*COLUMN_WIDTH, height() );
- m_pixCompose.resize( size() );
setMinimumSize( QSize( BAND_COUNT * COLUMN_WIDTH, 10 ) );
}
@@ -91,31 +90,16 @@
Analyzer::interpolate( s, m_scope );
update();
}
-void
-BarAnalyzer::paintEvent( QPaintEvent* )
-{
- QPainter p( &m_pixBarGradient );
- for ( int x=0, r=0x40, g=0x30, b=0xff, r2=255-r;
- x < height(); ++x )
- {
- for ( int y = x; y > 0; --y )
- {
- const double fraction = (double)y / height();
-// p.setPen( QColor( r + (int)(r2 * fraction), g, b - (int)(255 * fraction) \
) );
- p.setPen( QColor( r + (int)(r2 * fraction), g, b ) );
- p.drawLine( x*COLUMN_WIDTH, height() - y, (x+1)*COLUMN_WIDTH, height() - \
y );
- }
- }
- //Analyzer::interpolate( s, m_bands );
+void BarAnalyzer::paintEvent( QPaintEvent* )
+{
+ QPainter p( this );
- Scope &v = m_scope;
-
- for ( uint i = 0, x = 0, y2; i < v.size(); ++i, x+=COLUMN_WIDTH+1 )
+ for ( uint i = 0, x = 0, y2; i < m_scope.size(); ++i, x+=COLUMN_WIDTH+1 )
{
//assign pre[log10]'d value
- y2 = uint(v[i] * 256); //256 will be optimised to a bitshift //no, it's a \
float + y2 = uint(m_scope[i] * 256); //256 will be optimised to a bitshift \
//no, it's a float
y2 = m_lvlMapper[ (y2 > 255) ? 255 : y2 ]; //lvlMapper is array of ints with \
values 0 to height()
int change = y2 - barVector[i];
@@ -146,15 +130,13 @@
if ( m_roofMem[i].size() > NUM_ROOFS )
m_roofMem[i].erase( m_roofMem[i].begin() );
- //blt last n roofs, a.k.a motion blur
+ //Draw last n roofs, a.k.a motion blur
for ( uint c = 0; c < m_roofMem[i].size(); ++c )
- //bitBlt( m_pComposePixmap, x, m_roofMem[i]->at( c ), m_roofPixmaps[ c ] \
);
p.drawPixmap( x, m_roofMem[i][c], m_pixRoof[ NUM_ROOFS - 1 - c ] );
- //blt the bar
- //TODO: this isn't very kde4ish
- bitBlt( this, x, height() - y2,
- gradient(), y2 * COLUMN_WIDTH, height() - y2, COLUMN_WIDTH, y2 );
-// p.drawPixmap( x, height() - y2, gradient(), y2* COLUMN_WIDTH, height() - \
y2, COLUMN_WIDTH, y2 ); +
+ //Draw the bar
+ p.drawPixmap( x, height() - y2, *gradient(), y2 * COLUMN_WIDTH, height() - \
y2, COLUMN_WIDTH, y2 ); +
m_roofMem[i].push_back( height() - roofVector[i] - 2 );
//set roof parameters for the NEXT draw
--- trunk/extragear/multimedia/amarok/src/analyzers/baranalyzer.h #653109:653110
@@ -53,7 +53,6 @@
private:
QPixmap m_pixBarGradient;
- QPixmap m_pixCompose;
Scope m_scope; //so we don't create a vector every frame
QColor m_bg;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic