Skip to content

Commit

Permalink
fix #182171 correct update rect to cover entire meter rect
Browse files Browse the repository at this point in the history
Increased the QRect to cover entire meter are which is updated, to prevent a visual glitch whereby leftmost two columns of pixels weren't updated.  But since since the notches aren't redrawn when synth updates level, notches have been shifted a bit and end right before the mixer redraw area so they'll no longer overlap, which prevents a visual glitch whereby the notches would flicker off when mixer was redrawn.
  • Loading branch information
Eric Fontaine committed Mar 21, 2017
1 parent 735d766 commit 8c824e2
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions awl/mslider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

namespace Awl {

#define METER_LEFT_EDGE 18

//---------------------------------------------------------
// MeterSlider
//---------------------------------------------------------
Expand Down Expand Up @@ -82,7 +84,7 @@ void MeterSlider::setMeterVal(int channel, double v, double peak)
if (mustRedraw) {
int kh = sliderSize().height();
int mh = height() - kh;
update(20, kh / 2, _meterWidth-1, mh);
update(METER_LEFT_EDGE, kh / 2, _meterWidth-1, mh);
}
}

Expand Down Expand Up @@ -179,7 +181,7 @@ void MeterSlider::paintEvent(QPaintEvent* ev)
//---------------------------------------------------

int mw = _meterWidth / _channel;
int x = 18;
int x = METER_LEFT_EDGE;
int y1 = kh / 2;
int y3 = h - y1;

Expand Down Expand Up @@ -210,7 +212,7 @@ void MeterSlider::paintEvent(QPaintEvent* ev)
x += 4;

// optimize common case:
if (ev->rect() == QRect(20, kh / 2, _meterWidth - 1, mh))
if (ev->rect() == QRect(METER_LEFT_EDGE, kh / 2, _meterWidth - 1, mh))
return;

QColor sc(isEnabled() ? _scaleColor : Qt::gray);
Expand Down Expand Up @@ -239,14 +241,14 @@ void MeterSlider::paintEvent(QPaintEvent* ev)
h = y1 + lrint(i * mh / range);
s.setNum(i);
if (i == 0) {
p.drawText(QRect(0, h - 3, 15, 9), Qt::AlignRight, QString::fromStdString("dB"));
p.drawLine(18, h + 1, 23, h + 1);
p.drawText(QRect(0, h - 3, METER_LEFT_EDGE - 3, 9), Qt::AlignRight, QString::fromStdString("dB"));
p.drawLine(METER_LEFT_EDGE - 1, h + 1, METER_LEFT_EDGE - 1, h + 1);
continue;
}
else if (i == range)
h -= 2;
p.drawText(QRect(0, h - 3, 15, 9), Qt::AlignRight, QString::fromStdString("-") + s);
p.drawLine(18, h + 1, 23, h + 1);
p.drawText(QRect(0, h - 3, METER_LEFT_EDGE - 3, 9), Qt::AlignRight, QString::fromStdString("-") + s);
p.drawLine(METER_LEFT_EDGE - 1, h + 1, METER_LEFT_EDGE - 1, h + 1);
}

//---------------------------------------------------
Expand Down

0 comments on commit 8c824e2

Please sign in to comment.