frontend: Force update volume meter backgrounds

This commit is contained in:
Warchamp7
2026-01-23 13:42:19 -05:00
committed by Ryan Foster
parent 0d1f61b04b
commit 30633344e9
2 changed files with 9 additions and 7 deletions

View File

@@ -275,7 +275,8 @@ void VolumeMeter::setPeakMeterType(enum obs_peak_meter_type peakMeterType)
break;
}
updateBackgroundCache();
bool forceUpdate = true;
updateBackgroundCache(forceUpdate);
}
VolumeMeter::VolumeMeter(QWidget *parent, obs_source_t *source)
@@ -455,7 +456,8 @@ void VolumeMeter::refreshColors()
setForegroundWarningColor(getForegroundWarningColor());
setForegroundErrorColor(getForegroundErrorColor());
updateBackgroundCache();
bool forceUpdate = true;
updateBackgroundCache(forceUpdate);
}
QRect VolumeMeter::getBarRect() const
@@ -648,17 +650,17 @@ void VolumeMeter::paintVTicks(QPainter &painter, int x, int y, int height)
}
}
void VolumeMeter::updateBackgroundCache()
void VolumeMeter::updateBackgroundCache(bool force)
{
if (!size().isValid()) {
if (!force && !size().isValid()) {
return;
}
if (backgroundCache.size() == size() && !backgroundCache.isNull()) {
if (!force && backgroundCache.size() == size() && !backgroundCache.isNull()) {
return;
}
if (displayNrAudioChannels <= 0) {
if (!force && displayNrAudioChannels <= 0) {
return;
}

View File

@@ -83,7 +83,7 @@ private:
uint64_t displayInputPeakHoldLastUpdateTime[MAX_AUDIO_CHANNELS];
QPixmap backgroundCache;
void updateBackgroundCache();
void updateBackgroundCache(bool force = false);
QFont tickFont;
QRect tickTextTokenRect;