commit 9ce909787a26ac68d3e249cda548599338243bcb
parent 25a2a33246547d3e54986bc4db39f968df06ceb5
Author: Matt Demanett <matt@demanett.net>
Date: Tue, 28 Sep 2021 18:50:57 -0400
Rack2: fix up nightmode support for audio level displays.
Diffstat:
3 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/Mono.cpp b/src/Mono.cpp
@@ -65,21 +65,26 @@ struct MonoWidget : BGModuleWidget {
void draw(const DrawArgs& args) override {
nvgSave(args.vg);
- nvgGlobalTint(args.vg, color::WHITE);
for (int i = 0; i < _module->maxChannels; ++i) {
nvgBeginPath(args.vg);
if (!_module || i >= _module->_activeChannels) {
nvgFillColor(args.vg, inactiveBgColor);
}
else {
+ nvgSave(args.vg);
+ nvgGlobalTint(args.vg, color::WHITE);
nvgFillColor(args.vg, activeBgColor);
+ nvgRestore(args.vg);
}
nvgCircle(args.vg, (i % 4) * 10 + 5.0f, (i / 4) * 10 + 5.0f, 3.2f);
nvgFill(args.vg);
if (_module && _module->_channelLevels[i] > 0.0f) {
+ nvgSave(args.vg);
+ nvgGlobalTint(args.vg, color::WHITE);
nvgFillColor(args.vg, decibelsToColor(amplitudeToDecibels(_module->_channelLevels[i])));
nvgFill(args.vg);
+ nvgRestore(args.vg);
}
}
nvgRestore(args.vg);
@@ -113,7 +118,6 @@ struct MonoWidget : BGModuleWidget {
}
nvgSave(args.vg);
- nvgGlobalTint(args.vg, color::WHITE);
for (int i = 0; i < 35; i += 5) {
const Level& l = _levels.at(i / 5);
@@ -122,8 +126,11 @@ struct MonoWidget : BGModuleWidget {
nvgFillColor(args.vg, bgColor);
nvgFill(args.vg);
if (compressionDb > l.db) {
+ nvgSave(args.vg);
+ nvgGlobalTint(args.vg, color::WHITE);
nvgFillColor(args.vg, l.color);
nvgFill(args.vg);
+ nvgRestore(args.vg);
}
}
nvgRestore(args.vg);
diff --git a/src/Pressor.cpp b/src/Pressor.cpp
@@ -219,7 +219,6 @@ struct PressorWidget : BGModuleWidget {
}
nvgSave(args.vg);
- nvgGlobalTint(args.vg, color::WHITE);
for (int i = 0; i < 80; i += 5) {
const Level& l = _levels.at(i / 5);
@@ -228,8 +227,11 @@ struct PressorWidget : BGModuleWidget {
nvgFillColor(args.vg, bgColor);
nvgFill(args.vg);
if (compressionDb > l.db) {
+ nvgSave(args.vg);
+ nvgGlobalTint(args.vg, color::WHITE);
nvgFillColor(args.vg, l.color);
nvgFill(args.vg);
+ nvgRestore(args.vg);
}
}
nvgRestore(args.vg);
diff --git a/src/VU.cpp b/src/VU.cpp
@@ -89,7 +89,6 @@ struct VUDisplay : OpaqueWidget {
}
nvgSave(args.vg);
- nvgGlobalTint(args.vg, color::WHITE);
for (int i = 0; i < 180; i += 5) {
const Level& l = _levels.at(i / 5);
@@ -98,12 +97,18 @@ struct VUDisplay : OpaqueWidget {
nvgFillColor(args.vg, bgColor);
nvgFill(args.vg);
if (lPeakDb > l.db && lPeakDb < l.db + 2.0f) {
+ nvgSave(args.vg);
+ nvgGlobalTint(args.vg, color::WHITE);
nvgFillColor(args.vg, nvgRGBA(0x00, 0xdd, 0xff, 0xff));
nvgFill(args.vg);
+ nvgRestore(args.vg);
}
if (lDb > l.db) {
+ nvgSave(args.vg);
+ nvgGlobalTint(args.vg, color::WHITE);
nvgFillColor(args.vg, l.color);
nvgFill(args.vg);
+ nvgRestore(args.vg);
}
nvgBeginPath(args.vg);
@@ -111,12 +116,18 @@ struct VUDisplay : OpaqueWidget {
nvgFillColor(args.vg, bgColor);
nvgFill(args.vg);
if (rPeakDb > l.db && rPeakDb < l.db + 2.0f) {
+ nvgSave(args.vg);
+ nvgGlobalTint(args.vg, color::WHITE);
nvgFillColor(args.vg, nvgRGBA(0x00, 0xdd, 0xff, 0xff));
nvgFill(args.vg);
+ nvgRestore(args.vg);
}
if (rDb > l.db) {
+ nvgSave(args.vg);
+ nvgGlobalTint(args.vg, color::WHITE);
nvgFillColor(args.vg, l.color);
nvgFill(args.vg);
+ nvgRestore(args.vg);
}
}
nvgRestore(args.vg);