Skip to content

Commit

Permalink
draw only background when nothing else is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
m0dB committed Dec 2, 2022
1 parent 2919382 commit 399539a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,7 @@ else()
src/waveform/waveformmarklabel.cpp
src/waveform/waveformwidgetfactory.cpp
src/waveform/widgets/emptywaveformwidget.cpp
src/waveform/widgets/glwaveformwidgetabstract.cpp
src/waveform/widgets/glrgbwaveformwidget.cpp
src/waveform/widgets/glsimplewaveformwidget.cpp
src/waveform/widgets/glslwaveformwidget.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/waveform/renderers/waveformwidgetrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void WaveformWidgetRenderer::draw(QPainter* painter, QPaintEvent* event) {
// not ready to display need to wait until track initialization is done
// draw only first in stack (background)
int stackSize = m_rendererStack.size();
if (m_trackSamples <= 0.0 || m_playPos == -1) {
if (shouldOnlyDrawBackground()) {
if (stackSize) {
m_rendererStack.at(0)->draw(painter, event);
}
Expand Down
4 changes: 4 additions & 0 deletions src/waveform/renderers/waveformwidgetrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ class WaveformWidgetRenderer {

void setPassThroughEnabled(bool enabled);

bool shouldOnlyDrawBackground() const {
return m_trackSamples <= 0.0 || m_playPos == -1;
}

protected:
const QString m_group;
TrackPointer m_pTrack;
Expand Down

0 comments on commit 399539a

Please sign in to comment.