summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-03-03 20:59:48 +0100
committerMitya Selivanov <automainint@guattari.tech>2024-03-03 20:59:48 +0100
commit4c834d201e0687332a7cf6f14168d5fdbd4594db (patch)
tree5200cc2e49c8dd26b38a12c2a504ee10726dd488
parent9b6db4a90784e7658494d497c4713fa3391fe81b (diff)
downloadsaw-4c834d201e0687332a7cf6f14168d5fdbd4594db.zip
Update TODO; Small cleanup
-rw-r--r--TODO1
-rw-r--r--compile_flags.txt2
-rw-r--r--source/saw/main.c23
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);