MCPcopy Create free account
hub / github.com/LMMS/lmms / updateBackground

Method updateBackground

src/core/Track.cpp:1109–1147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1107
1108
1109void TrackContentWidget::updateBackground()
1110{
1111 const int tactsPerBar = 4;
1112 const TrackContainerView * tcv = m_trackView->trackContainerView();
1113
1114 // Assume even-pixels-per-tact. Makes sense, should be like this anyways
1115 int ppt = static_cast<int>( tcv->pixelsPerTact() );
1116
1117 int w = ppt * tactsPerBar;
1118 int h = height();
1119 m_background = QPixmap( w * 2, height() );
1120 QPainter pmp( &m_background );
1121
1122 pmp.fillRect( 0, 0, w, h, darkerColor() );
1123 pmp.fillRect( w, 0, w , h, lighterColor() );
1124
1125 // draw lines
1126 // vertical lines
1127 pmp.setPen( QPen( gridColor(), 1 ) );
1128 for( float x = 0; x < w * 2; x += ppt )
1129 {
1130 pmp.drawLine( QLineF( x, 0.0, x, h ) );
1131 }
1132
1133 pmp.setPen( QPen( embossColor(), 1 ) );
1134 for( float x = 1.0; x < w * 2; x += ppt )
1135 {
1136 pmp.drawLine( QLineF( x, 0.0, x, h ) );
1137 }
1138
1139 // horizontal line
1140 pmp.setPen( QPen( gridColor(), 1 ) );
1141 pmp.drawLine( 0, h-1, w*2, h-1 );
1142
1143 pmp.end();
1144
1145 // Force redraw
1146 update();
1147}
1148
1149
1150

Callers 1

setPixelsPerTactMethod · 0.80

Calls 5

drawLineMethod · 0.80
QPixmapClass · 0.50
trackContainerViewMethod · 0.45
pixelsPerTactMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected