From b28a5264c3193f8493f364f8ec6d0de3f0b5e5e1 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Fri, 2 May 2025 14:39:07 -0400 Subject: redraw all points after canvas is cleared --- ui.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ui.c') diff --git a/ui.c b/ui.c index 70df447..e0b1d64 100644 --- a/ui.c +++ b/ui.c @@ -54,6 +54,7 @@ static void compute_manifold_temperature(UI *ui, int idx); static void compute_volume_flow_rate(UI *ui, int idx); static void compute_mass_flow_rate(UI *ui, int idx); static void compute_mass_flow_rate_corrected(UI *ui, int idx); +static void draw_points(UI *ui); static void draw_point(UI *ui, int idx, mu_Color color); static void point_coords(UI *ui, int idx, int *x, int *y); static const Compressor *selected_compressor(UI *ui); @@ -443,8 +444,7 @@ compute(UI *ui, int idx) { compute_mass_flow_rate(ui, idx); compute_mass_flow_rate_corrected(ui, idx); - w_clear_canvas(&ui->comp_img); - draw_point(ui, idx, POINT_COLOR); + draw_points(ui); } void @@ -534,6 +534,17 @@ compute_mass_flow_rate_corrected(UI *ui, int idx) { w_set_number(ui->mass_flow_rate_corrected[idx], v); } +static void +draw_points(UI *ui) { + int i; + + w_clear_canvas(&ui->comp_img); + /* TODO: parallelize? */ + for (i = 0; i < ui->npoints; i++) { + draw_point(ui, i, POINT_COLOR); + } +} + static void draw_point(UI *ui, int idx, mu_Color color) { int x, y; -- cgit v1.2.3