summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/saw/main.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/source/saw/main.c b/source/saw/main.c
index 0849e09..e20b702 100644
--- a/source/saw/main.c
+++ b/source/saw/main.c
@@ -2508,21 +2508,22 @@ static void saw_ui_sampler(saw_sampler_t *sampler, f64 x0, f64 y0,
// Draw the sample outline
//
- if (sampler->outline.size == SAMPLER_OUTLINE_SIZE) {
- nvgBeginPath(saw_nvg);
-
- f64 dw = (f64) w / SAMPLER_OUTLINE_SIZE;
+ if (sampler->outline.size > 0) {
+ f64 dw = (f64) w / (f64) sampler->outline.size;
f64 h = sample_height * .5;
f64 y = frame_height - y0 - height + h;
- assert(dw > .0001);
- for (i64 i = 0; i < SAMPLER_OUTLINE_SIZE; i++)
- nvgRect(saw_nvg, x + dw * i,
- y - h * sampler->outline.values[i], dw,
- h * sampler->outline.values[i] * 2);
+ if (dw > .5) {
+ nvgBeginPath(saw_nvg);
- nvgFillColor(saw_nvg, nvgRGBAf(.8f, .4f, .0f, .7f));
- nvgFill(saw_nvg);
+ for (i64 i = 0; i < sampler->outline.size; i++)
+ nvgRect(saw_nvg, x + dw * i,
+ y - h * sampler->outline.values[i], dw,
+ h * sampler->outline.values[i] * 2.);
+
+ nvgFillColor(saw_nvg, nvgRGBAf(.8f, .4f, .0f, .7f));
+ nvgFill(saw_nvg);
+ }
}
} else {
nvgFontSize(saw_nvg, text_height * .5);