Attempt to fix caching bug in track backgrounds
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1933 0778d3d1-df1d-0410-868b-ea421aaaa00d Conflicts: ChangeLog.old src/core/track.cpp
This commit is contained in:
committed by
Paul Giblock
parent
70304f9800
commit
642aa97198
@@ -247,6 +247,12 @@
|
||||
* src/tracks/pattern.cpp:
|
||||
backport: added support for panning editing of notes
|
||||
|
||||
2008-12-15 Paul Giblock <drfaygo/at/gmail/dot/com>
|
||||
|
||||
* src/core/track.cpp:
|
||||
* include/track.h:
|
||||
Cache background per-object instead of per-class.
|
||||
|
||||
2008-12-14 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
|
||||
|
||||
* CMakeLists.txt:
|
||||
|
||||
@@ -895,46 +895,46 @@ void trackContentWidget::updateBackground()
|
||||
// Assume even-pixels-per-tact. Makes sense, should be like this anyways
|
||||
int ppt = static_cast<int>( tcv->pixelsPerTact() );
|
||||
|
||||
int w = ppt * tactsPerBar;
|
||||
int h = height();
|
||||
m_background = QPixmap( w * 2, height() );
|
||||
QPainter pmp( &m_background );
|
||||
int w = ppt * tactsPerBar;
|
||||
int h = height();
|
||||
m_background = QPixmap( w * 2, height() );
|
||||
QPainter pmp( &m_background );
|
||||
|
||||
QLinearGradient grad( 0, 1, 0, h-2 );
|
||||
pmp.fillRect( 0, 0, 1, h, QColor( 96, 96, 96 ) );
|
||||
pmp.fillRect( 1, 0, w+1, h, QColor( 128, 128, 128 ) );
|
||||
grad.setColorAt( 0.0, QColor( 64, 64, 64 ) );
|
||||
grad.setColorAt( 0.3, QColor( 128, 128, 128 ) );
|
||||
grad.setColorAt( 0.5, QColor( 128, 128, 128 ) );
|
||||
grad.setColorAt( 0.95, QColor( 160, 160, 160 ) );
|
||||
pmp.fillRect( 0, 1, w, h-2, grad );
|
||||
QLinearGradient grad( 0, 1, 0, h-2 );
|
||||
pmp.fillRect( 0, 0, 1, h, QColor( 96, 96, 96 ) );
|
||||
pmp.fillRect( 1, 0, w+1, h, QColor( 128, 128, 128 ) );
|
||||
grad.setColorAt( 0.0, QColor( 64, 64, 64 ) );
|
||||
grad.setColorAt( 0.3, QColor( 128, 128, 128 ) );
|
||||
grad.setColorAt( 0.5, QColor( 128, 128, 128 ) );
|
||||
grad.setColorAt( 0.95, QColor( 160, 160, 160 ) );
|
||||
pmp.fillRect( 0, 1, w, h-2, grad );
|
||||
|
||||
QLinearGradient grad2( 0,1, 0, h-2 );
|
||||
pmp.fillRect( w+1, 0, w , h, QColor( 96, 96, 96 ) );
|
||||
grad2.setColorAt( 0.0, QColor( 48, 48, 48 ) );
|
||||
grad2.setColorAt( 0.3, QColor( 96, 96, 96 ) );
|
||||
grad2.setColorAt( 0.5, QColor( 96, 96, 96 ) );
|
||||
grad2.setColorAt( 0.95, QColor( 120, 120, 120 ) );
|
||||
pmp.fillRect( w, 1, w , h-2, grad2 );
|
||||
QLinearGradient grad2( 0,1, 0, h-2 );
|
||||
pmp.fillRect( w+1, 0, w , h, QColor( 96, 96, 96 ) );
|
||||
grad2.setColorAt( 0.0, QColor( 48, 48, 48 ) );
|
||||
grad2.setColorAt( 0.3, QColor( 96, 96, 96 ) );
|
||||
grad2.setColorAt( 0.5, QColor( 96, 96, 96 ) );
|
||||
grad2.setColorAt( 0.95, QColor( 120, 120, 120 ) );
|
||||
pmp.fillRect( w, 1, w , h-2, grad2 );
|
||||
|
||||
// draw vertical lines
|
||||
pmp.setPen( QPen( QColor( 0, 0, 0, 112 ), 1 ) );
|
||||
for( float x = 0.5; x < w * 2; x += ppt )
|
||||
{
|
||||
pmp.drawLine( QLineF( x, 1.0, x, h-2.0 ) );
|
||||
}
|
||||
pmp.drawLine( 0, 1, w*2, 1 );
|
||||
// draw vertical lines
|
||||
pmp.setPen( QPen( QColor( 0, 0, 0, 112 ), 1 ) );
|
||||
for( float x = 0.5; x < w * 2; x += ppt )
|
||||
{
|
||||
pmp.drawLine( QLineF( x, 1.0, x, h-2.0 ) );
|
||||
}
|
||||
pmp.drawLine( 0, 1, w*2, 1 );
|
||||
|
||||
pmp.setPen( QPen( QColor( 255, 255, 255, 32 ), 1 ) );
|
||||
for( float x = 1.5; x < w * 2; x += ppt )
|
||||
{
|
||||
pmp.drawLine( QLineF( x, 1.0, x, h-2.0 ) );
|
||||
}
|
||||
pmp.drawLine( 0, h-2, w*2, h-2 );
|
||||
pmp.setPen( QPen( QColor( 255, 255, 255, 32 ), 1 ) );
|
||||
for( float x = 1.5; x < w * 2; x += ppt )
|
||||
{
|
||||
pmp.drawLine( QLineF( x, 1.0, x, h-2.0 ) );
|
||||
}
|
||||
pmp.drawLine( 0, h-2, w*2, h-2 );
|
||||
|
||||
pmp.end();
|
||||
pmp.end();
|
||||
|
||||
// Force redraw
|
||||
// Force redraw
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -1206,7 +1206,9 @@ void trackContentWidget::paintEvent( QPaintEvent * _pe )
|
||||
*/
|
||||
void trackContentWidget::resizeEvent( QResizeEvent * resizeEvent )
|
||||
{
|
||||
// Update backgroud
|
||||
updateBackground();
|
||||
// Force redraw
|
||||
QWidget::resizeEvent( resizeEvent );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user