mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
sysprof: avoid some overdraws in column layer
This commit is contained in:
@ -56,6 +56,8 @@ sysprof_column_layer_snapshot (GtkWidget *widget,
|
|||||||
const double *x_values;
|
const double *x_values;
|
||||||
const double *y_values;
|
const double *y_values;
|
||||||
const GdkRGBA *color;
|
const GdkRGBA *color;
|
||||||
|
double last_x = 0;
|
||||||
|
double last_y = 0;
|
||||||
guint n_values;
|
guint n_values;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
@ -91,18 +93,27 @@ sysprof_column_layer_snapshot (GtkWidget *widget,
|
|||||||
|
|
||||||
for (guint i = 0; i < n_values; i++)
|
for (guint i = 0; i < n_values; i++)
|
||||||
{
|
{
|
||||||
|
double x;
|
||||||
|
double y;
|
||||||
|
|
||||||
if (x_values[i] < .0)
|
if (x_values[i] < .0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (x_values[i] > 1.)
|
if (x_values[i] > 1.)
|
||||||
break;
|
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,
|
gtk_snapshot_append_color (snapshot,
|
||||||
color,
|
color,
|
||||||
&GRAPHENE_RECT_INIT (x_values[i] * width,
|
&GRAPHENE_RECT_INIT (x, 0, 1, y));
|
||||||
0,
|
|
||||||
1,
|
last_x = x;
|
||||||
ceil (y_values[i] * height)));
|
last_y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_snapshot_restore (snapshot);
|
gtk_snapshot_restore (snapshot);
|
||||||
|
|||||||
Reference in New Issue
Block a user