From 4285fab0c0b14cbbcf9ddbe29d274c0c55a04edd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 10 Feb 2025 15:27:55 -0500 Subject: Fully parenthesize expressions --- plugins/eg-sampler.lv2/sampler_ui.c | 4 ++-- plugins/eg-scope.lv2/examploscope_ui.c | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'plugins') diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c index b02082a..769dde0 100644 --- a/plugins/eg-sampler.lv2/sampler_ui.c +++ b/plugins/eg-sampler.lv2/sampler_ui.c @@ -183,13 +183,13 @@ on_canvas_expose(GtkWidget* widget, GdkEventExpose* event, gpointer data) // Draw line through top peaks for (int i = 0; i < n_peaks; ++i) { const float peak = peaks[i]; - cairo_line_to(cr, i * scale, mid_y + (peak / 2.0f) * size.height); + cairo_line_to(cr, i * scale, mid_y + ((peak / 2.0f) * size.height)); } // Continue through bottom peaks for (int i = n_peaks - 1; i >= 0; --i) { const float peak = peaks[i]; - cairo_line_to(cr, i * scale, mid_y - (peak / 2.0f) * size.height); + cairo_line_to(cr, i * scale, mid_y - ((peak / 2.0f) * size.height)); } // Close shape diff --git a/plugins/eg-scope.lv2/examploscope_ui.c b/plugins/eg-scope.lv2/examploscope_ui.c index 2ad42dc..50b8f4c 100644 --- a/plugins/eg-scope.lv2/examploscope_ui.c +++ b/plugins/eg-scope.lv2/examploscope_ui.c @@ -220,10 +220,10 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data) * - (DAHEIGHT / 2) * (VAL) * (GAIN) * ) */ - const float chn_y_offset = DAHEIGHT * c + DAHEIGHT * 0.5f - 0.5f; - const float chn_y_scale = DAHEIGHT * 0.5f * gain; + const float chn_y_offset = (DAHEIGHT * c) + (DAHEIGHT * 0.5f) - 0.5f; + const float chn_y_scale = (DAHEIGHT * 0.5f) * gain; -#define CYPOS(VAL) (chn_y_offset - (VAL) * chn_y_scale) +#define CYPOS(VAL) (chn_y_offset - ((VAL) * chn_y_scale)) cairo_save(cr); @@ -293,15 +293,15 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data) // Channel separator if (c > 0) { cairo_set_source_rgba(cr, .5, .5, .5, 1.0); - cairo_move_to(cr, 0, DAHEIGHT * c - .5); - cairo_line_to(cr, DAWIDTH, DAHEIGHT * c - .5); + cairo_move_to(cr, 0, (DAHEIGHT * c) - .5); + cairo_line_to(cr, DAWIDTH, (DAHEIGHT * c) - .5); cairo_stroke(cr); } // Zero scale line cairo_set_source_rgba(cr, .3, .3, .7, .5); - cairo_move_to(cr, 0, DAHEIGHT * (c + .5) - .5); - cairo_line_to(cr, DAWIDTH, DAHEIGHT * (c + .5) - .5); + cairo_move_to(cr, 0, (DAHEIGHT * (c + .5)) - .5); + cairo_line_to(cr, DAWIDTH, (DAHEIGHT * (c + .5)) - .5); cairo_stroke(cr); } -- cgit v1.2.1