From 989c04a6cb1a738eb660cf979cb4abdbe4f97a82 Mon Sep 17 00:00:00 2001 From: acuifex Date: Mon, 13 Mar 2023 18:49:47 +0300 Subject: [PATCH] Fix graph drop off on the right side Make an extra vertical line outside the render canvas to avoid creating a slanted line. --- src/process-monitor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/process-monitor.c b/src/process-monitor.c index 735879f..af1442e 100644 --- a/src/process-monitor.c +++ b/src/process-monitor.c @@ -154,6 +154,12 @@ xtm_process_monitor_graph_surface_create (XtmProcessMonitor *monitor, gint width cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND); cairo_set_antialias (cr, CAIRO_ANTIALIAS_DEFAULT); cairo_move_to (cr, width, height); + + /* Create a line before the call to cairo_translate, + * to avoid creating a downward sloping line going off the graph */ + peak = g_array_index (monitor->history, gfloat, 0); + cairo_line_to (cr, width, (1.0 - peak) * height); + for (i = 0; (step_size * (i - 1)) <= width; i++) { peak = g_array_index (monitor->history, gfloat, i); @@ -179,6 +185,10 @@ xtm_process_monitor_graph_surface_create (XtmProcessMonitor *monitor, gint width { cairo_translate (cr, step_size * i, 0); cairo_move_to (cr, width, height); + + peak = g_array_index (monitor->history_swap, gfloat, 0); + cairo_line_to (cr, width, (1.0 - peak) * height); + for (i = 0; (step_size * (i - 1)) <= width; i++) { peak = g_array_index (monitor->history_swap, gfloat, i);