Skip to content

Commit

Permalink
Fix rendering issue when rendering filling 0-height rectangle
Browse files Browse the repository at this point in the history
  • Loading branch information
david-c14 committed Nov 22, 2021
1 parent 965da8f commit 50ac076
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- 14-Nov-2021 Use keywords to make library searching more effective
- 14-Nov-2021 Add VM-104 Quad digital VU-meter
- 19-Nov-2021 Add VM-204 Quad vintage VU-meter
- 22-Nov-2021 Fix rendering bug in VM-1xx devices

## v1.1.10
- 10-Dec-2020 Update images in manual
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"donateUrl": "https://www.paypal.me/SubmarineFree",
"pluginUrl": "https://vcvrack.submarine.org.uk",
"changelogUrl": "https://github.com/david-c14/SubmarineFree/blob/main/changelog.md",
"version": "2.0.1",
"version": "2.0.0",
"modules": [
{
"slug":"AG-104",
Expand Down
16 changes: 9 additions & 7 deletions src/VMX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,17 @@ namespace {

void drawLayer(const DrawArgs &args, int layer) override {
if (layer == 1) {
float zeroPoint = squareScale(0, box.size.y, 0);
float meter = squareScale(value, 0.0f, box.size.y);

NVGpaint grad = nvgLinearGradient(args.vg, 0, zeroPoint - 10.0f, 0, zeroPoint + 10.0f, SUBLIGHTRED, nvgRGB(30,255,0));
nvgFillPaint(args.vg, grad);

nvgBeginPath(args.vg);
nvgRect(args.vg, 0, box.size.y - meter, box.size.x, meter);
nvgFill(args.vg);
if (meter) {
float zeroPoint = squareScale(0, box.size.y, 0);
NVGpaint grad = nvgLinearGradient(args.vg, 0, zeroPoint - 10.0f, 0, zeroPoint + 10.0f, SUBLIGHTRED, nvgRGB(30,255,0));
nvgFillPaint(args.vg, grad);

nvgBeginPath(args.vg);
nvgRect(args.vg, 0, box.size.y - meter, box.size.x, meter);
nvgFill(args.vg);
}
}
Widget::drawLayer(args, layer);
}
Expand Down

0 comments on commit 50ac076

Please sign in to comment.