Browse Source

Change TGrayModuleLightWidget background color. Don't draw light halo in framebuffers.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
cc20d1f2ac
3 changed files with 8 additions and 5 deletions
  1. +1
    -1
      include/componentlibrary.hpp
  2. +6
    -3
      src/app/LightWidget.cpp
  3. +1
    -1
      src/app/RackWidget.cpp

+ 1
- 1
include/componentlibrary.hpp View File

@@ -86,7 +86,7 @@ typedef TSvgLight<> SvgLight;
template <typename Base = app::ModuleLightWidget>
struct TGrayModuleLightWidget : Base {
TGrayModuleLightWidget() {
this->bgColor = nvgRGBA(0xaf, 0xaf, 0xaf, 0xff);
this->bgColor = nvgRGBA(0x55, 0x55, 0x55, 0xff);
this->borderColor = nvgRGBA(0, 0, 0, 53);
}
};


+ 6
- 3
src/app/LightWidget.cpp View File

@@ -14,9 +14,7 @@ void LightWidget::draw(const DrawArgs& args) {

// Background
if (bgColor.a > 0.0) {
// TODO Set color in TGrayModuleLightWidget instead.
nvgFillColor(args.vg, color::mult(bgColor, 0.5));
// nvgFillColor(args.vg, bgColor);
nvgFillColor(args.vg, bgColor);
nvgFill(args.vg);
}

@@ -33,6 +31,7 @@ void LightWidget::draw(const DrawArgs& args) {
TransparentWidget::draw(args);

// Dynamic light and halo
// Override tint from rack brightness adjustment
nvgGlobalAlpha(args.vg, 1.0);
// Use the formula `lightColor * (1 - dest) + dest` for blending
nvgGlobalCompositeBlendFunc(args.vg, NVG_ONE_MINUS_DST_COLOR, NVG_ONE);
@@ -53,6 +52,10 @@ void LightWidget::drawLight(const DrawArgs& args) {
}

void LightWidget::drawHalo(const DrawArgs& args) {
// Don't draw halo if rendering in a framebuffer, e.g. screenshots or Module Browser
if (args.fb)
return;

const float halo = settings::haloBrightness;
if (halo == 0.f)
return;


+ 1
- 1
src/app/RackWidget.cpp View File

@@ -98,7 +98,7 @@ void RackWidget::step() {

void RackWidget::draw(const DrawArgs& args) {
// Darken all children by user setting
float b = std::pow(settings::rackBrightness, 1.f);
float b = settings::rackBrightness;
nvgGlobalTint(args.vg, nvgRGBAf(b, b, b, 1));

// Resize and reposition the RackRail to align on the grid.


Loading…
Cancel
Save