sysprof: avoid some overdraws in column layer

This commit is contained in:
Christian Hergert
2023-07-19 10:43:17 -07:00
parent 88ae57dc73
commit 71f73309de

View File

@ -56,6 +56,8 @@ sysprof_column_layer_snapshot (GtkWidget *widget,
const double *x_values;
const double *y_values;
const GdkRGBA *color;
double last_x = 0;
double last_y = 0;
guint n_values;
int width;
int height;
@ -91,18 +93,27 @@ sysprof_column_layer_snapshot (GtkWidget *widget,
for (guint i = 0; i < n_values; i++)
{
double x;
double y;
if (x_values[i] < .0)
continue;
if (x_values[i] > 1.)
break;
x = round (x_values[i] * width);
y = ceil (y_values[i] * height);
if (x == last_x && y < last_y)
continue;
gtk_snapshot_append_color (snapshot,
color,
&GRAPHENE_RECT_INIT (x_values[i] * width,
0,
1,
ceil (y_values[i] * height)));
&GRAPHENE_RECT_INIT (x, 0, 1, y));
last_x = x;
last_y = y;
}
gtk_snapshot_restore (snapshot);