Skip to content

Commit

Permalink
Draw unity lines last
Browse files Browse the repository at this point in the history
Draw the unity lines last so that they are not affected by the white-ish overdraw in line 423 (after the changes).
  • Loading branch information
michaelgregorius committed Jan 3, 2024
1 parent 0126c02 commit 045a2cd
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/gui/widgets/Fader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,6 @@ void Fader::paintLevels(QPaintEvent * ev, QPainter & painter, bool linear)
linearGrad.setColorAt(ph.mapMaxZeroAndMinOne(mappedLastOk), okColor);
linearGrad.setColorAt(1, okColor);

QColor unityMarkerColor(127, 127, 127, 127);

// Draw left levels
QRect leftMeterMargins = leftMeterRect.marginsRemoved(QMargins(1, 0, 1, 0));
painter.fillRect(ph.getMeterRect(leftMeterMargins, mappedPeakL), linearGrad);
Expand All @@ -413,13 +411,6 @@ void Fader::paintLevels(QPaintEvent * ev, QPainter & painter, bool linear)
auto const peakRectL = ph.getPersistentPeakRect(leftMeterMargins, mappedPersistentPeakL);
painter.fillRect(peakRectL, linearGrad);

// Draw unity line (0 dbFS, 1.0 amplitude)
if (getRenderUnityLine())
{
auto const unityRectL = ph.getPersistentPeakRect(leftMeterRect, mappedUnity);
painter.fillRect(unityRectL, unityMarkerColor);
}

// Draw right levels
QRect rightMeterMargins = rightMeterRect.marginsRemoved(QMargins(1, 0, 1, 0));
painter.fillRect(ph.getMeterRect(rightMeterMargins, mappedPeakR), linearGrad);
Expand All @@ -428,18 +419,27 @@ void Fader::paintLevels(QPaintEvent * ev, QPainter & painter, bool linear)
auto const peakRectR = ph.getPersistentPeakRect(rightMeterMargins, mappedPersistentPeakR);
painter.fillRect(peakRectR, linearGrad);

// Draw unity line (0 dbFS, 1.0 amplitude)
// TODO
QPen pen(QColor(255, 255, 255, 18));
pen.setWidth(2);
painter.setPen(pen);
painter.drawPath(path);

// Draw left and right unity lines (0 dbFS, 1.0 amplitude)
QColor unityMarkerColor(127, 127, 127, 127);

if (getRenderUnityLine())
{
auto const unityRectL = ph.getPersistentPeakRect(leftMeterRect, mappedUnity);
painter.fillRect(unityRectL, unityMarkerColor);
}

if (getRenderUnityLine())
{
auto const unityRectR = ph.getPersistentPeakRect(rightMeterRect, mappedUnity);
painter.fillRect(unityRectR, unityMarkerColor);
}

// TODO
QPen pen(QColor(255, 255, 255, 18));
pen.setWidth(2);
painter.setPen(pen);
painter.drawPath(path);

painter.restore();
}
Expand Down

0 comments on commit 045a2cd

Please sign in to comment.