Skip to content

Commit

Permalink
Remove unnecessary assignments to pixmaps in TCOs
Browse files Browse the repository at this point in the history
Simplify the code that reinitializes the pixmap that caches the
graphical representation of some TCO widgets.

See comment in issue #3699.
  • Loading branch information
michaelgregorius committed Jul 15, 2017
1 parent cc38221 commit b7b2204
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/gui/AutomationPatternView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,10 @@ void AutomationPatternView::paintEvent( QPaintEvent * )

setNeedsUpdate( false );

m_paintPixmap = m_paintPixmap.isNull() == true || m_paintPixmap.size() != size()
? QPixmap( size() ) : m_paintPixmap;
if (m_paintPixmap.isNull() || m_paintPixmap.size() != size())
{
m_paintPixmap = QPixmap(size());
}

QPainter p( &m_paintPixmap );

Expand Down
6 changes: 4 additions & 2 deletions src/tracks/BBTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,10 @@ void BBTCOView::paintEvent( QPaintEvent * )

setNeedsUpdate( false );

m_paintPixmap = m_paintPixmap.isNull() == true || m_paintPixmap.size() != size()
? QPixmap( size() ) : m_paintPixmap;
if (m_paintPixmap.isNull() || m_paintPixmap.size() != size())
{
m_paintPixmap = QPixmap(size());
}

QPainter p( &m_paintPixmap );

Expand Down
6 changes: 4 additions & 2 deletions src/tracks/Pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,10 @@ void PatternView::paintEvent( QPaintEvent * )

setNeedsUpdate( false );

m_paintPixmap = m_paintPixmap.isNull() == true || m_paintPixmap.size() != size()
? QPixmap( size() ) : m_paintPixmap;
if (m_paintPixmap.isNull() || m_paintPixmap.size() != size())
{
m_paintPixmap = QPixmap(size());
}

QPainter p( &m_paintPixmap );

Expand Down
6 changes: 4 additions & 2 deletions src/tracks/SampleTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,10 @@ void SampleTCOView::paintEvent( QPaintEvent * pe )

setNeedsUpdate( false );

m_paintPixmap = m_paintPixmap.isNull() == true || m_paintPixmap.size() != size()
? QPixmap( size() ) : m_paintPixmap;
if (m_paintPixmap.isNull() || m_paintPixmap.size() != size())
{
m_paintPixmap = QPixmap(size());
}

QPainter p( &m_paintPixmap );

Expand Down

0 comments on commit b7b2204

Please sign in to comment.