libsysprof-gtk: ignore out-of-sequence data

We shouldn't be getting this here, but drop it if we do come across it so
that we don't screw up path drawing.
This commit is contained in:
Christian Hergert
2023-06-27 15:50:42 -07:00
parent 4efb0abbf8
commit c2d27ce85a

View File

@ -115,6 +115,12 @@ sysprof_line_layer_snapshot (GtkWidget *widget,
float x = floor (x_values[i] * width);
float y = floor (y_values[i] * height);
/* Skip if we are getting data incorrectly on the X axis.
* It should have been sorted by this point.
*/
if (x < last_x)
continue;
cairo_curve_to (cr,
last_x + ((x - last_x)/2),
last_y,
@ -134,6 +140,12 @@ sysprof_line_layer_snapshot (GtkWidget *widget,
float x = floor (x_values[i] * width);
float y = floor (y_values[i] * height);
/* Skip if we are getting data incorrectly on the X axis.
* It should have been sorted by this point.
*/
if (x < last_x)
continue;
cairo_line_to (cr, x, y);
last_x = x;