Skip to content

Commit

Permalink
Revert "Merge pull request mixxxdj#11052 from ronso0/vumetergl-init-p…
Browse files Browse the repository at this point in the history
…aint-fix"

This reverts commit dfa313f, reversing
changes made to dba50e2.
  • Loading branch information
napaalm committed Mar 23, 2023
1 parent efc66e2 commit 485c71c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
17 changes: 7 additions & 10 deletions src/widget/wvumetergl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
WVuMeterGL::WVuMeterGL(QWidget* parent)
: QGLWidget(parent, SharedGLContext::getWidget()),
WBaseWidget(this),
m_iPendingRenders(0),
m_bHasRendered(false),
m_bSwapNeeded(false),
m_dParameter(0),
m_dPeakParameter(0),
Expand Down Expand Up @@ -156,10 +156,10 @@ void WVuMeterGL::updateState(mixxx::Duration elapsed) {

void WVuMeterGL::paintEvent(QPaintEvent* e) {
Q_UNUSED(e);
// Force rerendering when render is called from the vsync thread, e.g. to
// Force a rerender when render is called from the vsync thread, e.g. to
// git rid artifacts after hiding and showing the mixer or incomplete
// initial drawing. Use 2 passes, in case triple buffering is used.
m_iPendingRenders = 2;
// initial drawing.
m_bHasRendered = false;
}

void WVuMeterGL::showEvent(QShowEvent* e) {
Expand All @@ -173,11 +173,8 @@ void WVuMeterGL::render(VSyncThread* vSyncThread) {

updateState(vSyncThread->sinceLastSwap());

if (m_dParameter != m_dLastParameter || m_dPeakParameter != m_dLastPeakParameter) {
m_iPendingRenders = 2;
}

if (m_iPendingRenders == 0) {
if (m_bHasRendered && m_dParameter == m_dLastParameter &&
m_dPeakParameter == m_dLastPeakParameter) {
return;
}

Expand Down Expand Up @@ -297,7 +294,7 @@ void WVuMeterGL::render(VSyncThread* vSyncThread) {

m_dLastParameter = m_dParameter;
m_dLastPeakParameter = m_dPeakParameter;
m_iPendingRenders--;
m_bHasRendered = true;
m_bSwapNeeded = true;
}

Expand Down
5 changes: 2 additions & 3 deletions src/widget/wvumetergl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ class WVuMeterGL : public QGLWidget, public WBaseWidget {
void showEvent(QShowEvent* /*unused*/) override;
void setPeak(double parameter);

// To make sure we render at least N times even when we have no signal,
// for example after showEvent()
int m_iPendingRenders;
// To make sure we render at least once even when we have no signal
bool m_bHasRendered;
// To indicate that we rendered so we need to swap
bool m_bSwapNeeded;
// Current parameter and peak parameter.
Expand Down

0 comments on commit 485c71c

Please sign in to comment.