From bc63f3f463f1da39ee1a8686d5ac5430a59d56c0 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 29 Jun 2023 15:09:03 -0700 Subject: [PATCH] libsysprof-gtk: improve alignment for lines --- src/libsysprof-gtk/sysprof-line-layer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libsysprof-gtk/sysprof-line-layer.c b/src/libsysprof-gtk/sysprof-line-layer.c index ace87af7..30bb60b6 100644 --- a/src/libsysprof-gtk/sysprof-line-layer.c +++ b/src/libsysprof-gtk/sysprof-line-layer.c @@ -107,12 +107,12 @@ sysprof_line_layer_snapshot (GtkWidget *widget, else cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); - cairo_set_line_width (cr, 1); + cairo_set_line_width (cr, .5); cairo_set_matrix (cr, &(cairo_matrix_t) {1, 0, 0, -1, 0, height}); first_x = last_x = floor (x_values[0] * width); - first_y = last_y = floor (y_values[0] * height); + first_y = last_y = floor (y_values[0] * height) + .5; cairo_move_to (cr, first_x, first_y); @@ -121,7 +121,7 @@ sysprof_line_layer_snapshot (GtkWidget *widget, for (guint i = 1; i < n_values; i++) { float x = floor (x_values[i] * width); - float y = floor (y_values[i] * height); + float y = floor (y_values[i] * height) + .5; /* Skip if we are getting data incorrectly on the X axis. * It should have been sorted by this point. @@ -146,7 +146,7 @@ sysprof_line_layer_snapshot (GtkWidget *widget, for (guint i = 1; i < n_values; i++) { float x = floor (x_values[i] * width); - float y = floor (y_values[i] * height); + float y = floor (y_values[i] * height) + .5; /* Skip if we are getting data incorrectly on the X axis. * It should have been sorted by this point. @@ -173,8 +173,8 @@ sysprof_line_layer_snapshot (GtkWidget *widget, fill_color.alpha *= .25; gdk_cairo_set_source_rgba (cr, &fill_color); - cairo_line_to (cr, last_x, 0); - cairo_line_to (cr, first_x, 0); + cairo_line_to (cr, last_x, .5); + cairo_line_to (cr, first_x, .5); cairo_line_to (cr, first_x, first_y); cairo_fill (cr); }