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 --- TODO | 1 + compile_flags.txt | 2 +- source/saw/main.c | 23 ++++++++++++----------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/TODO b/TODO index 448b01a..6b621aa 100644 --- a/TODO +++ b/TODO @@ -42,6 +42,7 @@ To-Do list - Dynamic layout - Color theme customization - Custom font and localization + - Help pop-up - Data diff --git a/compile_flags.txt b/compile_flags.txt index 3420365..b2644d9 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -1 +1 @@ --Wall -Werror -Isource +-Wall -Wextra -Werror -Isource 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