From 4c834d201e0687332a7cf6f14168d5fdbd4594db Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Sun, 3 Mar 2024 20:59:48 +0100 Subject: Update TODO; Small cleanup --- source/saw/main.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'source') 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); -- cgit v1.2.3