From 355afbfaa72c8cd6806a664e4f5ae611011a30b8 Mon Sep 17 00:00:00 2001 From: Umcaruje Date: Thu, 17 Aug 2017 13:57:10 +0200 Subject: [PATCH] Paint a black rectangle under patterns to prevent glitches (#3759) --- data/themes/default/style.css | 4 ++-- src/gui/AutomationPatternView.cpp | 10 ++++------ src/tracks/BBTrack.cpp | 5 ++++- src/tracks/Pattern.cpp | 3 +++ src/tracks/SampleTrack.cpp | 3 +++ 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/data/themes/default/style.css b/data/themes/default/style.css index a4fd6abd92a..fc25d6180dd 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -615,12 +615,12 @@ TrackContainerView QLabel /* common pattern colors */ TrackContentObjectView { - qproperty-mutedColor: rgb(255,255,255,100); + qproperty-mutedColor: rgba(255,255,255,100); qproperty-mutedBackgroundColor: #373d48; qproperty-selectedColor: #006B65; qproperty-BBPatternBackground: #373d48; qproperty-textColor: #fff; - qproperty-textShadowColor: rgb(0,0,0,200); + qproperty-textShadowColor: rgba(0,0,0,200); qproperty-gradient: false; /* boolean property, set true to have a gradient */ } diff --git a/src/gui/AutomationPatternView.cpp b/src/gui/AutomationPatternView.cpp index 66543816cb2..68bdb4bf25f 100644 --- a/src/gui/AutomationPatternView.cpp +++ b/src/gui/AutomationPatternView.cpp @@ -257,7 +257,10 @@ void AutomationPatternView::paintEvent( QPaintEvent * ) lingrad.setColorAt( 1, c.darker( 300 ) ); lingrad.setColorAt( 0, c ); - + + // paint a black rectangle under the pattern to prevent glitches with transparent backgrounds + p.fillRect( rect(), QColor( 0, 0, 0 ) ); + if( gradient() ) { p.fillRect( rect(), lingrad ); @@ -492,8 +495,3 @@ void AutomationPatternView::scaleTimemapToFit( float oldMin, float oldMax ) m_pat->generateTangents(); } - - - - - diff --git a/src/tracks/BBTrack.cpp b/src/tracks/BBTrack.cpp index 2e6e3407898..a4217d23d23 100644 --- a/src/tracks/BBTrack.cpp +++ b/src/tracks/BBTrack.cpp @@ -237,7 +237,10 @@ void BBTCOView::paintEvent( QPaintEvent * ) lingrad.setColorAt( 0, c.light( 130 ) ); lingrad.setColorAt( 1, c.light( 70 ) ); - + + // paint a black rectangle under the pattern to prevent glitches with transparent backgrounds + p.fillRect( rect(), QColor( 0, 0, 0 ) ); + if( gradient() ) { p.fillRect( rect(), lingrad ); diff --git a/src/tracks/Pattern.cpp b/src/tracks/Pattern.cpp index 4072c1d09ef..3fa01462b8d 100644 --- a/src/tracks/Pattern.cpp +++ b/src/tracks/Pattern.cpp @@ -890,6 +890,9 @@ void PatternView::paintEvent( QPaintEvent * ) lingrad.setColorAt( beatPattern ? 0 : 1, c.darker( 300 ) ); lingrad.setColorAt( beatPattern ? 1 : 0, c ); + // paint a black rectangle under the pattern to prevent glitches with transparent backgrounds + p.fillRect( rect(), QColor( 0, 0, 0 ) ); + if( gradient() ) { p.fillRect( rect(), lingrad ); diff --git a/src/tracks/SampleTrack.cpp b/src/tracks/SampleTrack.cpp index 45f58760729..0dd491c64d5 100644 --- a/src/tracks/SampleTrack.cpp +++ b/src/tracks/SampleTrack.cpp @@ -475,6 +475,9 @@ void SampleTCOView::paintEvent( QPaintEvent * pe ) lingrad.setColorAt( 1, c.darker( 300 ) ); lingrad.setColorAt( 0, c ); + // paint a black rectangle under the pattern to prevent glitches with transparent backgrounds + p.fillRect( rect(), QColor( 0, 0, 0 ) ); + if( gradient() ) { p.fillRect( rect(), lingrad );