Skip to content

Commit 3063334

Browse files
Warchamp7RytoEX
authored andcommitted
frontend: Force update volume meter backgrounds
1 parent 0d1f61b commit 3063334

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

frontend/components/VolumeMeter.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ void VolumeMeter::setPeakMeterType(enum obs_peak_meter_type peakMeterType)
275275
break;
276276
}
277277

278-
updateBackgroundCache();
278+
bool forceUpdate = true;
279+
updateBackgroundCache(forceUpdate);
279280
}
280281

281282
VolumeMeter::VolumeMeter(QWidget *parent, obs_source_t *source)
@@ -455,7 +456,8 @@ void VolumeMeter::refreshColors()
455456
setForegroundWarningColor(getForegroundWarningColor());
456457
setForegroundErrorColor(getForegroundErrorColor());
457458

458-
updateBackgroundCache();
459+
bool forceUpdate = true;
460+
updateBackgroundCache(forceUpdate);
459461
}
460462

461463
QRect VolumeMeter::getBarRect() const
@@ -648,17 +650,17 @@ void VolumeMeter::paintVTicks(QPainter &painter, int x, int y, int height)
648650
}
649651
}
650652

651-
void VolumeMeter::updateBackgroundCache()
653+
void VolumeMeter::updateBackgroundCache(bool force)
652654
{
653-
if (!size().isValid()) {
655+
if (!force && !size().isValid()) {
654656
return;
655657
}
656658

657-
if (backgroundCache.size() == size() && !backgroundCache.isNull()) {
659+
if (!force && backgroundCache.size() == size() && !backgroundCache.isNull()) {
658660
return;
659661
}
660662

661-
if (displayNrAudioChannels <= 0) {
663+
if (!force && displayNrAudioChannels <= 0) {
662664
return;
663665
}
664666

frontend/components/VolumeMeter.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class VolumeMeter : public QWidget {
8383
uint64_t displayInputPeakHoldLastUpdateTime[MAX_AUDIO_CHANNELS];
8484

8585
QPixmap backgroundCache;
86-
void updateBackgroundCache();
86+
void updateBackgroundCache(bool force = false);
8787

8888
QFont tickFont;
8989
QRect tickTextTokenRect;

0 commit comments

Comments
 (0)