diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2024-03-03 20:59:48 +0100 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2024-03-03 20:59:48 +0100 |
commit | 4c834d201e0687332a7cf6f14168d5fdbd4594db (patch) | |
tree | 5200cc2e49c8dd26b38a12c2a504ee10726dd488 /source | |
parent | 9b6db4a90784e7658494d497c4713fa3391fe81b (diff) | |
download | saw-4c834d201e0687332a7cf6f14168d5fdbd4594db.zip |
Update TODO; Small cleanup
Diffstat (limited to 'source')
-rw-r--r-- | source/saw/main.c | 23 |
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); |