commit 5b87bb8713cd0ae44441dbc62c2288ba2974b659
parent 8a4ad99d72b9ff80b408869093c02b6f869082d5
Author: Matt Demanett <matt@demanett.net>
Date: Sat, 18 May 2019 18:02:52 -0400
v1: "NVGcontext* vg" -> "const DrawArgs& args".
Diffstat:
9 files changed, 372 insertions(+), 372 deletions(-)
diff --git a/src/Blank3.cpp b/src/Blank3.cpp
@@ -29,7 +29,7 @@ struct Blank3Display : OpaqueWidget {
{
}
- void draw(NVGcontext* vg) override {
+ void draw(const DrawArgs& args) override {
// FIXME.v1
if (!_module) {
return;
@@ -37,30 +37,30 @@ struct Blank3Display : OpaqueWidget {
float offsetX = box.size.x / 2.0f;
float offsetY = box.size.y / 2.0f;
- nvgSave(vg);
- nvgTranslate(vg, offsetX, offsetY);
- nvgRotate(vg, M_PI/2.0f);
- nvgTranslate(vg, -offsetY, offsetX);
- nvgFontSize(vg, 54.0f);
- nvgFontFaceId(vg, _font->handle);
- nvgTextLetterSpacing(vg, 9.0f);
+ nvgSave(args.vg);
+ nvgTranslate(args.vg, offsetX, offsetY);
+ nvgRotate(args.vg, M_PI/2.0f);
+ nvgTranslate(args.vg, -offsetY, offsetX);
+ nvgFontSize(args.vg, 54.0f);
+ nvgFontFaceId(args.vg, _font->handle);
+ nvgTextLetterSpacing(args.vg, 9.0f);
if (_module->_level < 0.0f) {
- nvgFillColor(vg, textColor);
- nvgText(vg, 0, 0, _text, NULL);
+ nvgFillColor(args.vg, textColor);
+ nvgText(args.vg, 0, 0, _text, NULL);
}
else {
- nvgFillColor(vg, bgTextColor);
- nvgText(vg, 0, 0, _text, NULL);
+ nvgFillColor(args.vg, bgTextColor);
+ nvgText(args.vg, 0, 0, _text, NULL);
if (_module->_level > 0.0001f) {
- nvgFillColor(vg, decibelsToColor(amplitudeToDecibels(_module->_level)));
- nvgText(vg, 0, 0, _text, NULL);
+ nvgFillColor(args.vg, decibelsToColor(amplitudeToDecibels(_module->_level)));
+ nvgText(args.vg, 0, 0, _text, NULL);
}
}
- nvgBeginPath(vg);
- nvgRect(vg, 55, -20, 10, 10);
- nvgFillColor(vg, bgColor);
- nvgFill(vg);
- nvgRestore(vg);
+ nvgBeginPath(args.vg);
+ nvgRect(args.vg, 55, -20, 10, 10);
+ nvgFillColor(args.vg, bgColor);
+ nvgFill(args.vg);
+ nvgRestore(args.vg);
}
};
diff --git a/src/Blank6.cpp b/src/Blank6.cpp
@@ -29,7 +29,7 @@ struct Blank6Display : OpaqueWidget {
{
}
- void draw(NVGcontext* vg) override {
+ void draw(const DrawArgs& args) override {
// FIXME.v1
if (!_module) {
return;
@@ -37,30 +37,30 @@ struct Blank6Display : OpaqueWidget {
float offsetX = box.size.x / 2.0f;
float offsetY = box.size.y / 2.0f;
- nvgSave(vg);
- nvgTranslate(vg, offsetX, offsetY);
- nvgRotate(vg, M_PI/2.0f);
- nvgTranslate(vg, -offsetY, offsetX);
- nvgFontSize(vg, 52.0f);
- nvgFontFaceId(vg, _font->handle);
- nvgTextLetterSpacing(vg, 9.0f);
+ nvgSave(args.vg);
+ nvgTranslate(args.vg, offsetX, offsetY);
+ nvgRotate(args.vg, M_PI/2.0f);
+ nvgTranslate(args.vg, -offsetY, offsetX);
+ nvgFontSize(args.vg, 52.0f);
+ nvgFontFaceId(args.vg, _font->handle);
+ nvgTextLetterSpacing(args.vg, 9.0f);
if (_module->_level < 0.0f) {
- nvgFillColor(vg, textColor);
- nvgText(vg, 0, 0, _text, NULL);
+ nvgFillColor(args.vg, textColor);
+ nvgText(args.vg, 0, 0, _text, NULL);
}
else {
- nvgFillColor(vg, bgTextColor);
- nvgText(vg, 0, 0, _text, NULL);
+ nvgFillColor(args.vg, bgTextColor);
+ nvgText(args.vg, 0, 0, _text, NULL);
if (_module->_level > 0.0001f) {
- nvgFillColor(vg, decibelsToColor(amplitudeToDecibels(_module->_level)));
- nvgText(vg, 0, 0, _text, NULL);
+ nvgFillColor(args.vg, decibelsToColor(amplitudeToDecibels(_module->_level)));
+ nvgText(args.vg, 0, 0, _text, NULL);
}
}
- nvgBeginPath(vg);
- nvgRect(vg, 97, -20, 10, 10);
- nvgFillColor(vg, bgColor);
- nvgFill(vg);
- nvgRestore(vg);
+ nvgBeginPath(args.vg);
+ nvgRect(args.vg, 97, -20, 10, 10);
+ nvgFillColor(args.vg, bgColor);
+ nvgFill(args.vg);
+ nvgRestore(args.vg);
}
};
diff --git a/src/Pressor.cpp b/src/Pressor.cpp
@@ -146,26 +146,26 @@ struct CompressionDisplay : OpaqueWidget {
}
}
- void draw(NVGcontext* vg) override {
+ void draw(const DrawArgs& args) override {
// FIXME.v1
if (!_module) {
return;
}
- nvgSave(vg);
+ nvgSave(args.vg);
for (int i = 0; i < 80; i += 5) {
const Level& l = _levels.at(i / 5);
- nvgBeginPath(vg);
- nvgRect(vg, 3, i + 1, 5, 4);
- nvgFillColor(vg, bgColor);
- nvgFill(vg);
+ nvgBeginPath(args.vg);
+ nvgRect(args.vg, 3, i + 1, 5, 4);
+ nvgFillColor(args.vg, bgColor);
+ nvgFill(args.vg);
if (_module->_compressionDb > l.db) {
- nvgFillColor(vg, l.color);
- nvgFill(vg);
+ nvgFillColor(args.vg, l.color);
+ nvgFill(args.vg);
}
}
- nvgRestore(vg);
+ nvgRestore(args.vg);
}
};
diff --git a/src/Reftone.cpp b/src/Reftone.cpp
@@ -51,14 +51,14 @@ struct ReftoneDisplay : TransparentWidget {
{
}
- void draw(NVGcontext* vg) override;
- void drawBackground(NVGcontext* vg);
- void drawText(NVGcontext* vg, const char* s, float x, float y, int size);
- void drawCenteredText(NVGcontext* vg, const char* s, float y, int size);
- float textRenderWidth(NVGcontext* vg, const char* s, int size);
+ void draw(const DrawArgs& args) override;
+ void drawBackground(const DrawArgs& args);
+ void drawText(const DrawArgs& args, const char* s, float x, float y, int size);
+ void drawCenteredText(const DrawArgs& args, const char* s, float y, int size);
+ float textRenderWidth(const DrawArgs& args, const char* s, int size);
};
-void ReftoneDisplay::draw(NVGcontext* vg) {
+void ReftoneDisplay::draw(const DrawArgs& args) {
// FIXME.v1
if (!_module) {
return;
@@ -133,52 +133,52 @@ void ReftoneDisplay::draw(NVGcontext* vg) {
}
}
- drawBackground(vg);
+ drawBackground(args.vg);
if (sharpFlat) {
- drawText(vg, pitch, 3, 20, 28);
- drawText(vg, sharpFlat, 16, 12, 16);
- drawText(vg, octave, 22, 20, 28);
+ drawText(args.vg, pitch, 3, 20, 28);
+ drawText(args.vg, sharpFlat, 16, 12, 16);
+ drawText(args.vg, octave, 22, 20, 28);
}
else {
char s[n];
snprintf(s, n, "%s%s", pitch, octave);
- drawCenteredText(vg, s, 20, 28);
+ drawCenteredText(args.vg, s, 20, 28);
}
- drawCenteredText(vg, fine, 32.5, 14);
- drawCenteredText(vg, frequency, 45, 14);
+ drawCenteredText(args.vg, fine, 32.5, 14);
+ drawCenteredText(args.vg, frequency, 45, 14);
}
-void ReftoneDisplay::drawBackground(NVGcontext* vg) {
- nvgSave(vg);
- nvgBeginPath(vg);
- nvgRect(vg, 0, 0, _size.x, _size.y);
- nvgFillColor(vg, nvgRGBA(0x00, 0x00, 0x00, 0xff));
- nvgFill(vg);
- nvgRestore(vg);
+void ReftoneDisplay::drawBackground(const DrawArgs& args) {
+ nvgSave(args.vg);
+ nvgBeginPath(args.vg);
+ nvgRect(args.vg, 0, 0, _size.x, _size.y);
+ nvgFillColor(args.vg, nvgRGBA(0x00, 0x00, 0x00, 0xff));
+ nvgFill(args.vg);
+ nvgRestore(args.vg);
}
-void ReftoneDisplay::drawText(NVGcontext* vg, const char* s, float x, float y, int size) {
- nvgSave(vg);
- nvgTranslate(vg, x, y);
- nvgFontSize(vg, size);
- nvgFontFaceId(vg, _font->handle);
- nvgFillColor(vg, _textColor);
- nvgText(vg, 0, 0, s, NULL);
- nvgRestore(vg);
+void ReftoneDisplay::drawText(const DrawArgs& args, const char* s, float x, float y, int size) {
+ nvgSave(args.vg);
+ nvgTranslate(args.vg, x, y);
+ nvgFontSize(args.vg, size);
+ nvgFontFaceId(args.vg, _font->handle);
+ nvgFillColor(args.vg, _textColor);
+ nvgText(args.vg, 0, 0, s, NULL);
+ nvgRestore(args.vg);
}
-void ReftoneDisplay::drawCenteredText(NVGcontext* vg, const char* s, float y, int size) {
- float x = textRenderWidth(vg, s, size);
+void ReftoneDisplay::drawCenteredText(const DrawArgs& args, const char* s, float y, int size) {
+ float x = textRenderWidth(args.vg, s, size);
x = std::max(0.0f, _size.x - x);
x /= 2.0;
- drawText(vg, s, x, y, size);
+ drawText(args.vg, s, x, y, size);
}
-float ReftoneDisplay::textRenderWidth(NVGcontext* vg, const char* s, int size) {
- // nvgSave(vg);
- // nvgFontSize(vg, size);
- // float w = nvgTextBounds(vg, 0, 0, s, NULL, NULL);
- // nvgRestore(vg);
+float ReftoneDisplay::textRenderWidth(const DrawArgs& args, const char* s, int size) {
+ // nvgSave(args.vg);
+ // nvgFontSize(args.vg, size);
+ // float w = nvgTextBounds(args.vg, 0, 0, s, NULL, NULL);
+ // nvgRestore(args.vg);
// return w - size/4.0;
return strlen(s) * (size / 2.1);
}
diff --git a/src/VU.cpp b/src/VU.cpp
@@ -42,7 +42,7 @@ struct VUDisplay : OpaqueWidget {
}
}
- void draw(NVGcontext* vg) override {
+ void draw(const DrawArgs& args) override {
// FIXME.v1
if (!_module) {
return;
@@ -63,29 +63,29 @@ struct VUDisplay : OpaqueWidget {
rDb = -100.0f;
}
- nvgSave(vg);
+ nvgSave(args.vg);
for (int i = 0; i < 180; i += 5) {
const Level& l = _levels.at(i / 5);
- nvgBeginPath(vg);
- nvgRect(vg, 3, i + 1, 5, 4);
- nvgFillColor(vg, bgColor);
- nvgFill(vg);
+ nvgBeginPath(args.vg);
+ nvgRect(args.vg, 3, i + 1, 5, 4);
+ nvgFillColor(args.vg, bgColor);
+ nvgFill(args.vg);
if (lDb > l.db) {
- nvgFillColor(vg, l.color);
- nvgFill(vg);
+ nvgFillColor(args.vg, l.color);
+ nvgFill(args.vg);
}
- nvgBeginPath(vg);
- nvgRect(vg, 10, i + 1, 5, 4);
- nvgFillColor(vg, bgColor);
- nvgFill(vg);
+ nvgBeginPath(args.vg);
+ nvgRect(args.vg, 10, i + 1, 5, 4);
+ nvgFillColor(args.vg, bgColor);
+ nvgFill(args.vg);
if (rDb > l.db) {
- nvgFillColor(vg, l.color);
- nvgFill(vg);
+ nvgFillColor(args.vg, l.color);
+ nvgFill(args.vg);
}
}
- nvgRestore(vg);
+ nvgRestore(args.vg);
}
};
diff --git a/src/Walk2.cpp b/src/Walk2.cpp
@@ -164,7 +164,7 @@ struct Walk2Display : TransparentWidget {
}
}
- void draw(NVGcontext* vg) override {
+ void draw(const DrawArgs& args) override {
// FIXME.v1
if (!_module) {
return;
@@ -189,13 +189,13 @@ struct Walk2Display : TransparentWidget {
}
}
- drawBackground(vg);
+ drawBackground(args.vg);
float strokeWidth = 2.0f; // FIXME.v1 std::max(1.0f, 3 - gRackScene->zoomWidget->zoom);
- nvgSave(vg);
- nvgScissor(vg, _insetAround, _insetAround, _drawSize.x / 2, _drawSize.y / 2);
+ nvgSave(args.vg);
+ nvgScissor(args.vg, _insetAround, _insetAround, _drawSize.x / 2, _drawSize.y / 2);
if (_module->_zoomOut) {
- nvgScale(vg, 0.5f, 0.5f);
+ nvgScale(args.vg, 0.5f, 0.5f);
strokeWidth *= 2.0f;
}
else {
@@ -203,91 +203,91 @@ struct Walk2Display : TransparentWidget {
tx *= -_drawSize.x / 4;
float ty = 1.0f - (clamp(_module->_offsetY, -5.0f, 5.0f) / 5.0f);
ty *= -_drawSize.y / 4;
- nvgTranslate(vg, tx, ty);
+ nvgTranslate(args.vg, tx, ty);
}
- drawAxes(vg, strokeWidth);
- drawTrace(vg, _traceColor, _module->_outsX, _module->_outsY);
- nvgRestore(vg);
+ drawAxes(args.vg, strokeWidth);
+ drawTrace(args.vg, _traceColor, _module->_outsX, _module->_outsY);
+ nvgRestore(args.vg);
}
- void drawBackground(NVGcontext* vg) {
- nvgSave(vg);
- nvgBeginPath(vg);
- nvgRect(vg, 0, 0, _size.x, _size.y);
- nvgFillColor(vg, nvgRGBA(0x00, 0x00, 0x00, 0xff));
- nvgFill(vg);
- nvgStrokeColor(vg, nvgRGBA(0xc0, 0xc0, 0xc0, 0xff));
- nvgStroke(vg);
- nvgRestore(vg);
+ void drawBackground(const DrawArgs& args) {
+ nvgSave(args.vg);
+ nvgBeginPath(args.vg);
+ nvgRect(args.vg, 0, 0, _size.x, _size.y);
+ nvgFillColor(args.vg, nvgRGBA(0x00, 0x00, 0x00, 0xff));
+ nvgFill(args.vg);
+ nvgStrokeColor(args.vg, nvgRGBA(0xc0, 0xc0, 0xc0, 0xff));
+ nvgStroke(args.vg);
+ nvgRestore(args.vg);
}
- void drawAxes(NVGcontext* vg, float strokeWidth) {
+ void drawAxes(const DrawArgs& args, float strokeWidth) {
const float shortTick = 4.0f;
const float longTick = 8.0f;
float dot = 0.5f * strokeWidth;
- nvgSave(vg);
- nvgStrokeColor(vg, _axisColor);
- nvgStrokeWidth(vg, strokeWidth);
+ nvgSave(args.vg);
+ nvgStrokeColor(args.vg, _axisColor);
+ nvgStrokeWidth(args.vg, strokeWidth);
- nvgBeginPath(vg);
- nvgMoveTo(vg, _insetAround, _midY);
- nvgLineTo(vg, _insetAround + _drawSize.x, _midY);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, _insetAround, _midY);
+ nvgLineTo(args.vg, _insetAround + _drawSize.x, _midY);
+ nvgStroke(args.vg);
- nvgBeginPath(vg);
- nvgMoveTo(vg, _midX, _insetAround);
- nvgLineTo(vg, _midX, _insetAround + _drawSize.y);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, _midX, _insetAround);
+ nvgLineTo(args.vg, _midX, _insetAround + _drawSize.y);
+ nvgStroke(args.vg);
for (int i = 1; i <= 10; ++i) {
float tick = i % 5 == 0 ? longTick : shortTick;
float x = (i * 0.1f) * 0.5f * _drawSize.x;
- nvgBeginPath(vg);
- nvgMoveTo(vg, _midX + x, _midY - tick);
- nvgLineTo(vg, _midX + x, _midY + tick);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, _midX + x, _midY - tick);
+ nvgLineTo(args.vg, _midX + x, _midY + tick);
+ nvgStroke(args.vg);
- nvgBeginPath(vg);
- nvgMoveTo(vg, _midX - x, _midY - tick);
- nvgLineTo(vg, _midX - x, _midY + tick);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, _midX - x, _midY - tick);
+ nvgLineTo(args.vg, _midX - x, _midY + tick);
+ nvgStroke(args.vg);
float y = (i * 0.1f) * 0.5f * _drawSize.y;
- nvgBeginPath(vg);
- nvgMoveTo(vg, _midX - tick, _midY + y);
- nvgLineTo(vg, _midX + tick, _midY + y);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, _midX - tick, _midY + y);
+ nvgLineTo(args.vg, _midX + tick, _midY + y);
+ nvgStroke(args.vg);
- nvgBeginPath(vg);
- nvgMoveTo(vg, _midX - tick, _midY - y);
- nvgLineTo(vg, _midX + tick, _midY - y);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, _midX - tick, _midY - y);
+ nvgLineTo(args.vg, _midX + tick, _midY - y);
+ nvgStroke(args.vg);
if (_module->_drawGrid) {
for (int j = 1; j <= 10; ++j) {
float y = (j * 0.1f) * 0.5f * _drawSize.y;
- nvgBeginPath(vg);
- nvgMoveTo(vg, _midX + x - dot, _midY + y);
- nvgLineTo(vg, _midX + x + dot, _midY + y);
- nvgStroke(vg);
-
- nvgBeginPath(vg);
- nvgMoveTo(vg, _midX - x - dot, _midY + y);
- nvgLineTo(vg, _midX - x + dot, _midY + y);
- nvgStroke(vg);
-
- nvgBeginPath(vg);
- nvgMoveTo(vg, _midX - x - dot, _midY - y);
- nvgLineTo(vg, _midX - x + dot, _midY - y);
- nvgStroke(vg);
-
- nvgBeginPath(vg);
- nvgMoveTo(vg, _midX + x - dot, _midY - y);
- nvgLineTo(vg, _midX + x + dot, _midY - y);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, _midX + x - dot, _midY + y);
+ nvgLineTo(args.vg, _midX + x + dot, _midY + y);
+ nvgStroke(args.vg);
+
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, _midX - x - dot, _midY + y);
+ nvgLineTo(args.vg, _midX - x + dot, _midY + y);
+ nvgStroke(args.vg);
+
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, _midX - x - dot, _midY - y);
+ nvgLineTo(args.vg, _midX - x + dot, _midY - y);
+ nvgStroke(args.vg);
+
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, _midX + x - dot, _midY - y);
+ nvgLineTo(args.vg, _midX + x + dot, _midY - y);
+ nvgStroke(args.vg);
}
}
}
@@ -298,66 +298,66 @@ struct Walk2Display : TransparentWidget {
float x = _midX - _drawSize.x / 4;
float y = _midY - _drawSize.y / 4;
- nvgBeginPath(vg);
- nvgMoveTo(vg, x - tick, y);
- nvgLineTo(vg, x + tick, y);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, x - tick, y);
+ nvgLineTo(args.vg, x + tick, y);
+ nvgStroke(args.vg);
- nvgBeginPath(vg);
- nvgMoveTo(vg, x, y - tick);
- nvgLineTo(vg, x, y + tick);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, x, y - tick);
+ nvgLineTo(args.vg, x, y + tick);
+ nvgStroke(args.vg);
}
{
float x = _midX + _drawSize.x / 4;
float y = _midY - _drawSize.y / 4;
- nvgBeginPath(vg);
- nvgMoveTo(vg, x - tick, y);
- nvgLineTo(vg, x + tick, y);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, x - tick, y);
+ nvgLineTo(args.vg, x + tick, y);
+ nvgStroke(args.vg);
- nvgBeginPath(vg);
- nvgMoveTo(vg, x, y - tick);
- nvgLineTo(vg, x, y + tick);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, x, y - tick);
+ nvgLineTo(args.vg, x, y + tick);
+ nvgStroke(args.vg);
}
{
float x = _midX + _drawSize.x / 4;
float y = _midY + _drawSize.y / 4;
- nvgBeginPath(vg);
- nvgMoveTo(vg, x - tick, y);
- nvgLineTo(vg, x + tick, y);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, x - tick, y);
+ nvgLineTo(args.vg, x + tick, y);
+ nvgStroke(args.vg);
- nvgBeginPath(vg);
- nvgMoveTo(vg, x, y - tick);
- nvgLineTo(vg, x, y + tick);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, x, y - tick);
+ nvgLineTo(args.vg, x, y + tick);
+ nvgStroke(args.vg);
}
{
float x = _midX - _drawSize.x / 4;
float y = _midY + _drawSize.y / 4;
- nvgBeginPath(vg);
- nvgMoveTo(vg, x - tick, y);
- nvgLineTo(vg, x + tick, y);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, x - tick, y);
+ nvgLineTo(args.vg, x + tick, y);
+ nvgStroke(args.vg);
- nvgBeginPath(vg);
- nvgMoveTo(vg, x, y - tick);
- nvgLineTo(vg, x, y + tick);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, x, y - tick);
+ nvgLineTo(args.vg, x, y + tick);
+ nvgStroke(args.vg);
}
}
- nvgRestore(vg);
+ nvgRestore(args.vg);
}
- void drawTrace(NVGcontext* vg, NVGcolor color, HistoryBuffer<float>& x, HistoryBuffer<float>& y) {
- nvgSave(vg);
- // nvgGlobalCompositeOperation(vg, NVG_LIGHTER);
+ void drawTrace(const DrawArgs& args, NVGcolor color, HistoryBuffer<float>& x, HistoryBuffer<float>& y) {
+ nvgSave(args.vg);
+ // nvgGlobalCompositeOperation(args.vg, NVG_LIGHTER);
// int n = _module->historyPoints;
// float beginRadius = std::max(1.0f, 2.0f - gRackScene->zoomWidget->zoom);
@@ -366,12 +366,12 @@ struct Walk2Display : TransparentWidget {
// float radius = beginRadius;
// float alphaStep = (color.a - 0.1f) / (float)n;
// for (int i = 0; i < n; ++i) {
- // nvgBeginPath(vg);
- // nvgCircle(vg, cvToPixel(_midX, _drawSize.x, x.value(i)), cvToPixel(_midY, _drawSize.y, y.value(i)), radius);
- // nvgStrokeColor(vg, color);
- // nvgFillColor(vg, color);
- // nvgStroke(vg);
- // nvgFill(vg);
+ // nvgBeginPath(args.vg);
+ // nvgCircle(args.vg, cvToPixel(_midX, _drawSize.x, x.value(i)), cvToPixel(_midY, _drawSize.y, y.value(i)), radius);
+ // nvgStrokeColor(args.vg, color);
+ // nvgFillColor(args.vg, color);
+ // nvgStroke(args.vg);
+ // nvgFill(args.vg);
// radius -= radiusStep;
// color.a -= alphaStep;
// }
@@ -389,23 +389,23 @@ struct Walk2Display : TransparentWidget {
float alphaStep = (color.a - endAlpha) / (float)n;
color.a = endAlpha;
for (int i = n - 1; i > 0; --i) {
- nvgBeginPath(vg);
- nvgMoveTo(vg, cvToPixelX(_midX, _drawSize.x, x.value(i - 1)), cvToPixelY(_midY, _drawSize.y, y.value(i - 1)));
- nvgLineTo(vg, cvToPixelX(_midX, _drawSize.x, x.value(i)), cvToPixelY(_midY, _drawSize.y, y.value(i)));
- nvgStrokeWidth(vg, width);
- nvgStrokeColor(vg, color);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, cvToPixelX(_midX, _drawSize.x, x.value(i - 1)), cvToPixelY(_midY, _drawSize.y, y.value(i - 1)));
+ nvgLineTo(args.vg, cvToPixelX(_midX, _drawSize.x, x.value(i)), cvToPixelY(_midY, _drawSize.y, y.value(i)));
+ nvgStrokeWidth(args.vg, width);
+ nvgStrokeColor(args.vg, color);
+ nvgStroke(args.vg);
width += widthStep;
color.a += alphaStep;
}
- nvgBeginPath(vg);
- nvgCircle(vg, cvToPixelX(_midX, _drawSize.x, x.value(0)), cvToPixelY(_midY, _drawSize.y, y.value(0)), 0.5f * width);
- nvgStrokeColor(vg, color);
- nvgFillColor(vg, color);
- nvgStroke(vg);
- nvgFill(vg);
-
- nvgRestore(vg);
+ nvgBeginPath(args.vg);
+ nvgCircle(args.vg, cvToPixelX(_midX, _drawSize.x, x.value(0)), cvToPixelY(_midY, _drawSize.y, y.value(0)), 0.5f * width);
+ nvgStrokeColor(args.vg, color);
+ nvgFillColor(args.vg, color);
+ nvgStroke(args.vg);
+ nvgFill(args.vg);
+
+ nvgRestore(args.vg);
}
inline float cvToPixelX(float mid, float extent, float cv) {
diff --git a/src/analyzer_base.cpp b/src/analyzer_base.cpp
@@ -206,47 +206,47 @@ void AnalyzerCore::stepChannel(int channelIndex, Input& input) {
}
-void AnalyzerDisplay::draw(NVGcontext* vg) {
+void AnalyzerDisplay::draw(const DrawArgs& args) {
// FIXME.v1
if (!_module) {
return;
}
- drawBackground(vg);
+ drawBackground(args.vg);
float strokeWidth = 2.0f; // FIXME.v1 std::max(1.0f, 3 - gRackScene->zoomWidget->zoom);
_xAxisLogFactor = (_module->_rangeMaxHz - _module->_rangeMinHz) / _module->_rangeMaxHz;
_xAxisLogFactor *= 1.0f - baseXAxisLogFactor;
_xAxisLogFactor = 1.0f - _xAxisLogFactor;
- nvgSave(vg);
- nvgScissor(vg, _insetAround, _insetAround, _size.x - _insetAround, _size.y - _insetAround);
- drawHeader(vg);
- drawYAxis(vg, strokeWidth);
- drawXAxis(vg, strokeWidth);
+ nvgSave(args.vg);
+ nvgScissor(args.vg, _insetAround, _insetAround, _size.x - _insetAround, _size.y - _insetAround);
+ drawHeader(args.vg);
+ drawYAxis(args.vg, strokeWidth);
+ drawXAxis(args.vg, strokeWidth);
for (int i = 0; i < _module->_core._nChannels; ++i) {
ChannelAnalyzer* channel = _module->_core._channels[i];
if (channel) {
- drawGraph(vg, channel->getBins(), channel->_binsN, _channelColors[i % channelColorsN], strokeWidth);
+ drawGraph(args.vg, channel->getBins(), channel->_binsN, _channelColors[i % channelColorsN], strokeWidth);
}
}
- nvgRestore(vg);
+ nvgRestore(args.vg);
}
-void AnalyzerDisplay::drawBackground(NVGcontext* vg) {
- nvgSave(vg);
- nvgBeginPath(vg);
- nvgRect(vg, 0, 0, _size.x, _size.y);
- nvgFillColor(vg, nvgRGBA(0x00, 0x00, 0x00, 0xff));
- nvgFill(vg);
+void AnalyzerDisplay::drawBackground(const DrawArgs& args) {
+ nvgSave(args.vg);
+ nvgBeginPath(args.vg);
+ nvgRect(args.vg, 0, 0, _size.x, _size.y);
+ nvgFillColor(args.vg, nvgRGBA(0x00, 0x00, 0x00, 0xff));
+ nvgFill(args.vg);
if (_drawInset) {
- nvgStrokeColor(vg, nvgRGBA(0xc0, 0xc0, 0xc0, 0xff));
- nvgStroke(vg);
+ nvgStrokeColor(args.vg, nvgRGBA(0xc0, 0xc0, 0xc0, 0xff));
+ nvgStroke(args.vg);
}
- nvgRestore(vg);
+ nvgRestore(args.vg);
}
-void AnalyzerDisplay::drawHeader(NVGcontext* vg) {
- nvgSave(vg);
+void AnalyzerDisplay::drawHeader(const DrawArgs& args) {
+ nvgSave(args.vg);
const int textY = -4;
const int charPx = 5;
@@ -255,7 +255,7 @@ void AnalyzerDisplay::drawHeader(NVGcontext* vg) {
int x = _insetAround + 2;
int n = snprintf(s, sLen, "Peaks (+/-%0.1f):", (engineGetSampleRate() / 2.0f) / (float)(_module->_core.size() / _module->_core._binAverageN));
- drawText(vg, s, x, _insetTop + textY);
+ drawText(args.vg, s, x, _insetTop + textY);
x += n * charPx - 0;
int spacing = 3;
@@ -267,124 +267,124 @@ void AnalyzerDisplay::drawHeader(NVGcontext* vg) {
ChannelAnalyzer* channel = _module->_core._channels[i];
if (channel) {
snprintf(s, sLen, "%c:%7.1f", 'A' + i, channel->getPeak());
- drawText(vg, s, x, _insetTop + textY, 0.0, &_channelColors[i % channelColorsN]);
+ drawText(args.vg, s, x, _insetTop + textY, 0.0, &_channelColors[i % channelColorsN]);
}
x += 9 * charPx + spacing;
}
- nvgRestore(vg);
+ nvgRestore(args.vg);
}
-void AnalyzerDisplay::drawYAxis(NVGcontext* vg, float strokeWidth) {
- nvgSave(vg);
- nvgStrokeColor(vg, _axisColor);
- nvgStrokeWidth(vg, strokeWidth);
+void AnalyzerDisplay::drawYAxis(const DrawArgs& args, float strokeWidth) {
+ nvgSave(args.vg);
+ nvgStrokeColor(args.vg, _axisColor);
+ nvgStrokeWidth(args.vg, strokeWidth);
const int lineX = _insetLeft - 2;
const int textX = 9;
const float textR = -M_PI/2.0;
- nvgBeginPath(vg);
+ nvgBeginPath(args.vg);
int lineY = _insetTop;
- nvgMoveTo(vg, lineX, lineY);
- nvgLineTo(vg, _size.x - _insetRight, lineY);
- nvgStroke(vg);
+ nvgMoveTo(args.vg, lineX, lineY);
+ nvgLineTo(args.vg, _size.x - _insetRight, lineY);
+ nvgStroke(args.vg);
- nvgBeginPath(vg);
+ nvgBeginPath(args.vg);
lineY = _insetTop + (_graphSize.y - _graphSize.y*(_module->_rangeDb - _positiveDisplayDB + 12.0)/_module->_rangeDb);
- nvgMoveTo(vg, lineX, lineY);
- nvgLineTo(vg, _size.x - _insetRight, lineY);
- nvgStroke(vg);
- drawText(vg, "12", textX, lineY + 5.0, textR);
+ nvgMoveTo(args.vg, lineX, lineY);
+ nvgLineTo(args.vg, _size.x - _insetRight, lineY);
+ nvgStroke(args.vg);
+ drawText(args.vg, "12", textX, lineY + 5.0, textR);
- nvgBeginPath(vg);
+ nvgBeginPath(args.vg);
lineY = _insetTop + (_graphSize.y - _graphSize.y*(_module->_rangeDb - _positiveDisplayDB)/_module->_rangeDb);
- nvgMoveTo(vg, lineX, lineY);
- nvgLineTo(vg, _size.x - _insetRight, lineY);
- nvgStrokeWidth(vg, strokeWidth * 1.5);
- nvgStroke(vg);
- nvgStrokeWidth(vg, strokeWidth);
- drawText(vg, "0", textX, lineY + 2.3, textR);
-
- nvgBeginPath(vg);
+ nvgMoveTo(args.vg, lineX, lineY);
+ nvgLineTo(args.vg, _size.x - _insetRight, lineY);
+ nvgStrokeWidth(args.vg, strokeWidth * 1.5);
+ nvgStroke(args.vg);
+ nvgStrokeWidth(args.vg, strokeWidth);
+ drawText(args.vg, "0", textX, lineY + 2.3, textR);
+
+ nvgBeginPath(args.vg);
lineY = _insetTop + (_graphSize.y - _graphSize.y*(_module->_rangeDb - _positiveDisplayDB - 12.0)/_module->_rangeDb);
- nvgMoveTo(vg, lineX, lineY);
- nvgLineTo(vg, _size.x - _insetRight, lineY);
- nvgStroke(vg);
- drawText(vg, "-12", textX, lineY + 10, textR);
+ nvgMoveTo(args.vg, lineX, lineY);
+ nvgLineTo(args.vg, _size.x - _insetRight, lineY);
+ nvgStroke(args.vg);
+ drawText(args.vg, "-12", textX, lineY + 10, textR);
- nvgBeginPath(vg);
+ nvgBeginPath(args.vg);
lineY = _insetTop + (_graphSize.y - _graphSize.y*(_module->_rangeDb - _positiveDisplayDB - 24.0)/_module->_rangeDb);
- nvgMoveTo(vg, lineX, lineY);
- nvgLineTo(vg, _size.x - _insetRight, lineY);
- nvgStroke(vg);
- drawText(vg, "-24", textX, lineY + 10, textR);
+ nvgMoveTo(args.vg, lineX, lineY);
+ nvgLineTo(args.vg, _size.x - _insetRight, lineY);
+ nvgStroke(args.vg);
+ drawText(args.vg, "-24", textX, lineY + 10, textR);
- nvgBeginPath(vg);
+ nvgBeginPath(args.vg);
lineY = _insetTop + (_graphSize.y - _graphSize.y*(_module->_rangeDb - _positiveDisplayDB - 48.0)/_module->_rangeDb);
- nvgMoveTo(vg, lineX, lineY);
- nvgLineTo(vg, _size.x - _insetRight, lineY);
- nvgStroke(vg);
- drawText(vg, "-48", textX, lineY + 10, textR);
+ nvgMoveTo(args.vg, lineX, lineY);
+ nvgLineTo(args.vg, _size.x - _insetRight, lineY);
+ nvgStroke(args.vg);
+ drawText(args.vg, "-48", textX, lineY + 10, textR);
if (_module->_rangeDb > 100.0) {
- nvgBeginPath(vg);
+ nvgBeginPath(args.vg);
lineY = _insetTop + (_graphSize.y - _graphSize.y*(_module->_rangeDb - _positiveDisplayDB - 96.0)/_module->_rangeDb);
- nvgMoveTo(vg, lineX, lineY);
- nvgLineTo(vg, _size.x - _insetRight, lineY);
- nvgStroke(vg);
- drawText(vg, "-96", textX, lineY + 10, textR);
+ nvgMoveTo(args.vg, lineX, lineY);
+ nvgLineTo(args.vg, _size.x - _insetRight, lineY);
+ nvgStroke(args.vg);
+ drawText(args.vg, "-96", textX, lineY + 10, textR);
}
- nvgBeginPath(vg);
+ nvgBeginPath(args.vg);
lineY = _insetTop + _graphSize.y + 1;
- nvgMoveTo(vg, lineX, lineY);
- nvgLineTo(vg, _size.x - _insetRight, lineY);
- nvgStroke(vg);
+ nvgMoveTo(args.vg, lineX, lineY);
+ nvgLineTo(args.vg, _size.x - _insetRight, lineY);
+ nvgStroke(args.vg);
- nvgBeginPath(vg);
- nvgMoveTo(vg, lineX, _insetTop);
- nvgLineTo(vg, lineX, lineY);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, lineX, _insetTop);
+ nvgLineTo(args.vg, lineX, lineY);
+ nvgStroke(args.vg);
- drawText(vg, "dB", textX, _size.y - _insetBottom, textR);
+ drawText(args.vg, "dB", textX, _size.y - _insetBottom, textR);
- nvgRestore(vg);
+ nvgRestore(args.vg);
}
-void AnalyzerDisplay::drawXAxis(NVGcontext* vg, float strokeWidth) {
- nvgSave(vg);
- nvgStrokeColor(vg, _axisColor);
- nvgStrokeWidth(vg, strokeWidth);
+void AnalyzerDisplay::drawXAxis(const DrawArgs& args, float strokeWidth) {
+ nvgSave(args.vg);
+ nvgStrokeColor(args.vg, _axisColor);
+ nvgStrokeWidth(args.vg, strokeWidth);
float hz = 100.0f;
while (hz < _module->_rangeMaxHz && hz < 1001.0) {
if (hz >= _module->_rangeMinHz) {
- drawXAxisLine(vg, hz);
+ drawXAxisLine(args.vg, hz);
}
hz += 100.0;
}
hz = 2000.0;
while (hz < _module->_rangeMaxHz && hz < 10001.0) {
if (hz >= _module->_rangeMinHz) {
- drawXAxisLine(vg, hz);
+ drawXAxisLine(args.vg, hz);
}
hz += 1000.0;
}
hz = 20000.0;
while (hz < _module->_rangeMaxHz && hz < 100001.0) {
if (hz >= _module->_rangeMinHz) {
- drawXAxisLine(vg, hz);
+ drawXAxisLine(args.vg, hz);
}
hz += 10000.0;
}
- drawText(vg, "Hz", _insetLeft, _size.y - 2);
+ drawText(args.vg, "Hz", _insetLeft, _size.y - 2);
if (_module->_rangeMinHz <= 100.0f) {
float x = (100.0 - _module->_rangeMinHz) / (_module->_rangeMaxHz - _module->_rangeMinHz);
x = powf(x, _xAxisLogFactor);
if (x < 1.0) {
x *= _graphSize.x;
- drawText(vg, "100", _insetLeft + x - 8, _size.y - 2);
+ drawText(args.vg, "100", _insetLeft + x - 8, _size.y - 2);
}
}
if (_module->_rangeMinHz <= 1000.0f) {
@@ -392,7 +392,7 @@ void AnalyzerDisplay::drawXAxis(NVGcontext* vg, float strokeWidth) {
x = powf(x, _xAxisLogFactor);
if (x < 1.0) {
x *= _graphSize.x;
- drawText(vg, "1k", _insetLeft + x - 4, _size.y - 2);
+ drawText(args.vg, "1k", _insetLeft + x - 4, _size.y - 2);
}
}
if (_module->_rangeMinHz <= 10000.0f) {
@@ -400,7 +400,7 @@ void AnalyzerDisplay::drawXAxis(NVGcontext* vg, float strokeWidth) {
x = powf(x, _xAxisLogFactor);
if (x < 1.0) {
x *= _graphSize.x;
- drawText(vg, "10k", _insetLeft + x - 4, _size.y - 2);
+ drawText(args.vg, "10k", _insetLeft + x - 4, _size.y - 2);
}
}
if (_module->_rangeMinHz > 1000.0f) {
@@ -416,61 +416,61 @@ void AnalyzerDisplay::drawXAxis(NVGcontext* vg, float strokeWidth) {
const int sLen = 32;
char s[sLen];
snprintf(s, sLen, "%dk", (int)(hz / 1000.0f));
- drawText(vg, s, _insetLeft + x - 7, _size.y - 2);
+ drawText(args.vg, s, _insetLeft + x - 7, _size.y - 2);
}
}
hz += 10000.0f;
}
}
- nvgRestore(vg);
+ nvgRestore(args.vg);
}
-void AnalyzerDisplay::drawXAxisLine(NVGcontext* vg, float hz) {
+void AnalyzerDisplay::drawXAxisLine(const DrawArgs& args, float hz) {
float x = (hz - _module->_rangeMinHz) / (_module->_rangeMaxHz - _module->_rangeMinHz);
x = powf(x, _xAxisLogFactor);
if (x < 1.0) {
x *= _graphSize.x;
- nvgBeginPath(vg);
- nvgMoveTo(vg, _insetLeft + x, _insetTop);
- nvgLineTo(vg, _insetLeft + x, _insetTop + _graphSize.y);
- nvgStroke(vg);
+ nvgBeginPath(args.vg);
+ nvgMoveTo(args.vg, _insetLeft + x, _insetTop);
+ nvgLineTo(args.vg, _insetLeft + x, _insetTop + _graphSize.y);
+ nvgStroke(args.vg);
}
}
-void AnalyzerDisplay::drawGraph(NVGcontext* vg, const float* bins, int binsN, NVGcolor color, float strokeWidth) {
+void AnalyzerDisplay::drawGraph(const DrawArgs& args, const float* bins, int binsN, NVGcolor color, float strokeWidth) {
float range = (_module->_rangeMaxHz - _module->_rangeMinHz) / (0.5f * engineGetSampleRate());
int pointsN = roundf(range * (_module->_core.size() / 2));
range = _module->_rangeMinHz / (0.5f * engineGetSampleRate());
int pointsOffset = roundf(range * (_module->_core.size() / 2));
- nvgSave(vg);
- nvgScissor(vg, _insetLeft, _insetTop, _graphSize.x, _graphSize.y);
- nvgStrokeColor(vg, color);
- nvgStrokeWidth(vg, strokeWidth);
- nvgBeginPath(vg);
+ nvgSave(args.vg);
+ nvgScissor(args.vg, _insetLeft, _insetTop, _graphSize.x, _graphSize.y);
+ nvgStrokeColor(args.vg, color);
+ nvgStrokeWidth(args.vg, strokeWidth);
+ nvgBeginPath(args.vg);
for (int i = 0; i < pointsN; ++i) {
int height = binValueToHeight(bins[pointsOffset + i]);
if (i == 0) {
- nvgMoveTo(vg, _insetLeft, _insetTop + (_graphSize.y - height));
+ nvgMoveTo(args.vg, _insetLeft, _insetTop + (_graphSize.y - height));
}
else {
float x = _graphSize.x * powf(i / (float)pointsN, _xAxisLogFactor);
- nvgLineTo(vg, _insetLeft + x, _insetTop + (_graphSize.y - height));
+ nvgLineTo(args.vg, _insetLeft + x, _insetTop + (_graphSize.y - height));
}
}
- nvgStroke(vg);
- nvgRestore(vg);
+ nvgStroke(args.vg);
+ nvgRestore(args.vg);
}
-void AnalyzerDisplay::drawText(NVGcontext* vg, const char* s, float x, float y, float rotation, const NVGcolor* color) {
- nvgSave(vg);
- nvgTranslate(vg, x, y);
- nvgRotate(vg, rotation);
- nvgFontSize(vg, 10);
- nvgFontFaceId(vg, _font->handle);
- nvgFillColor(vg, color ? *color : _textColor);
- nvgText(vg, 0, 0, s, NULL);
- nvgRestore(vg);
+void AnalyzerDisplay::drawText(const DrawArgs& args, const char* s, float x, float y, float rotation, const NVGcolor* color) {
+ nvgSave(args.vg);
+ nvgTranslate(args.vg, x, y);
+ nvgRotate(args.vg, rotation);
+ nvgFontSize(args.vg, 10);
+ nvgFontFaceId(args.vg, _font->handle);
+ nvgFillColor(args.vg, color ? *color : _textColor);
+ nvgText(args.vg, 0, 0, s, NULL);
+ nvgRestore(args.vg);
}
int AnalyzerDisplay::binValueToHeight(float value) {
diff --git a/src/analyzer_base.hpp b/src/analyzer_base.hpp
@@ -160,14 +160,14 @@ struct AnalyzerDisplay : TransparentWidget {
{
}
- void draw(NVGcontext* vg) override;
- void drawBackground(NVGcontext* vg);
- void drawHeader(NVGcontext* vg);
- void drawYAxis(NVGcontext* vg, float strokeWidth);
- void drawXAxis(NVGcontext* vg, float strokeWidth);
- void drawXAxisLine(NVGcontext* vg, float hz);
- void drawGraph(NVGcontext* vg, const float* bins, int binsN, NVGcolor color, float strokeWidth);
- void drawText(NVGcontext* vg, const char* s, float x, float y, float rotation = 0.0, const NVGcolor* color = NULL);
+ void draw(const DrawArgs& args) override;
+ void drawBackground(const DrawArgs& args);
+ void drawHeader(const DrawArgs& args);
+ void drawYAxis(const DrawArgs& args, float strokeWidth);
+ void drawXAxis(const DrawArgs& args, float strokeWidth);
+ void drawXAxisLine(const DrawArgs& args, float hz);
+ void drawGraph(const DrawArgs& args, const float* bins, int binsN, NVGcolor color, float strokeWidth);
+ void drawText(const DrawArgs& args, const char* s, float x, float y, float rotation = 0.0, const NVGcolor* color = NULL);
int binValueToHeight(float value);
};
diff --git a/src/widgets.cpp b/src/widgets.cpp
@@ -152,48 +152,48 @@ NVGcolor bogaudio::decibelsToColor(float db) {
void VUSlider::draw(const DrawArgs& args) {
- nvgSave(args.vg);
+ nvgSave(args.args.vg);
{
- nvgBeginPath(args.vg);
- nvgRoundedRect(args.vg, 6, 3, 6, box.size.y - 6, 2);
- nvgFillColor(args.vg, nvgRGBA(0x22, 0x22, 0x22, 0xff));
- nvgFill(args.vg);
- nvgStrokeColor(args.vg, nvgRGBA(0x88, 0x88, 0x88, 0xff));
- nvgStroke(args.vg);
+ nvgBeginPath(args.args.vg);
+ nvgRoundedRect(args.args.vg, 6, 3, 6, box.size.y - 6, 2);
+ nvgFillColor(args.args.vg, nvgRGBA(0x22, 0x22, 0x22, 0xff));
+ nvgFill(args.args.vg);
+ nvgStrokeColor(args.args.vg, nvgRGBA(0x88, 0x88, 0x88, 0xff));
+ nvgStroke(args.args.vg);
}
- nvgRestore(args.vg);
+ nvgRestore(args.args.vg);
- nvgSave(args.vg);
+ nvgSave(args.args.vg);
{
- // FIXME.v1 nvgTranslate(args.vg, 0, (box.size.y - 13.0f) * (1.0f - value));
- nvgBeginPath(args.vg);
- nvgRoundedRect(args.vg, 0, 0, 18, 13, 1.5);
- nvgFillColor(args.vg, nvgRGBA(0x77, 0x77, 0x77, 0xff));
- nvgFill(args.vg);
-
- nvgBeginPath(args.vg);
- nvgRect(args.vg, 0, 2, 18, 9);
- nvgFillColor(args.vg, nvgRGBA(0x44, 0x44, 0x44, 0xff));
- nvgFill(args.vg);
-
- nvgBeginPath(args.vg);
- nvgRect(args.vg, 0, 6, 18, 1);
- nvgFillColor(args.vg, nvgRGBA(0xfa, 0xfa, 0xfa, 0xff));
- nvgFill(args.vg);
-
- nvgBeginPath(args.vg);
- nvgRoundedRect(args.vg, 2, 4, 14, 5, 1.0);
- nvgFillColor(args.vg, nvgRGBA(0xaa, 0xaa, 0xaa, 0xff));
- nvgFill(args.vg);
+ // FIXME.v1 nvgTranslate(args.args.vg, 0, (box.size.y - 13.0f) * (1.0f - value));
+ nvgBeginPath(args.args.vg);
+ nvgRoundedRect(args.args.vg, 0, 0, 18, 13, 1.5);
+ nvgFillColor(args.args.vg, nvgRGBA(0x77, 0x77, 0x77, 0xff));
+ nvgFill(args.args.vg);
+
+ nvgBeginPath(args.args.vg);
+ nvgRect(args.args.vg, 0, 2, 18, 9);
+ nvgFillColor(args.args.vg, nvgRGBA(0x44, 0x44, 0x44, 0xff));
+ nvgFill(args.args.vg);
+
+ nvgBeginPath(args.args.vg);
+ nvgRect(args.args.vg, 0, 6, 18, 1);
+ nvgFillColor(args.args.vg, nvgRGBA(0xfa, 0xfa, 0xfa, 0xff));
+ nvgFill(args.args.vg);
+
+ nvgBeginPath(args.args.vg);
+ nvgRoundedRect(args.args.vg, 2, 4, 14, 5, 1.0);
+ nvgFillColor(args.args.vg, nvgRGBA(0xaa, 0xaa, 0xaa, 0xff));
+ nvgFill(args.args.vg);
float db = _vuLevel ? *_vuLevel : 0.0f;
if (db > 0.0f) {
db = amplitudeToDecibels(db);
- nvgBeginPath(args.vg);
- nvgRoundedRect(args.vg, 2, 4, 14, 5, 1.0);
- nvgFillColor(args.vg, decibelsToColor(db));
- nvgFill(args.vg);
+ nvgBeginPath(args.args.vg);
+ nvgRoundedRect(args.args.vg, 2, 4, 14, 5, 1.0);
+ nvgFillColor(args.args.vg, decibelsToColor(db));
+ nvgFill(args.args.vg);
}
}
- nvgRestore(args.vg);
+ nvgRestore(args.args.vg);
}