fix #182171 correct update rect to cover entire meter rect
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.
This commit is contained in:
parent
735d766b72
commit
8c824e26f2
1 changed files with 9 additions and 7 deletions
|
@ -23,6 +23,8 @@
|
|||
|
||||
namespace Awl {
|
||||
|
||||
#define METER_LEFT_EDGE 18
|
||||
|
||||
//---------------------------------------------------------
|
||||
// MeterSlider
|
||||
//---------------------------------------------------------
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue