mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 15:40:53 +00:00
libsysprof-gtk: move some math to the GPU
We can at least do the subtraction on the GPU by setting up the transformation instead of on every data point. It would be nice to do the rect as well but it looks like we might get culled do to the rect width.
This commit is contained in:
@ -48,6 +48,7 @@ sysprof_column_layer_snapshot (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
SysprofColumnLayer *self = (SysprofColumnLayer *)widget;
|
SysprofColumnLayer *self = (SysprofColumnLayer *)widget;
|
||||||
const SysprofXYSeriesValue *values;
|
const SysprofXYSeriesValue *values;
|
||||||
|
graphene_matrix_t flip_y;
|
||||||
guint n_values;
|
guint n_values;
|
||||||
double min_x, max_x;
|
double min_x, max_x;
|
||||||
int line_width;
|
int line_width;
|
||||||
@ -67,6 +68,11 @@ sysprof_column_layer_snapshot (GtkWidget *widget,
|
|||||||
!(values = sysprof_xy_series_get_values (self->series, &n_values)))
|
!(values = sysprof_xy_series_get_values (self->series, &n_values)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
gtk_snapshot_save (snapshot);
|
||||||
|
|
||||||
|
graphene_matrix_init_from_2d (&flip_y, 1, 0, 0, -1, 0, height);
|
||||||
|
gtk_snapshot_transform_matrix (snapshot, &flip_y);
|
||||||
|
|
||||||
sysprof_xy_series_get_range (self->series, &min_x, NULL, &max_x, NULL);
|
sysprof_xy_series_get_range (self->series, &min_x, NULL, &max_x, NULL);
|
||||||
|
|
||||||
/* NOTE: We might want to allow setting a "bucket size" for the
|
/* NOTE: We might want to allow setting a "bucket size" for the
|
||||||
@ -85,10 +91,12 @@ sysprof_column_layer_snapshot (GtkWidget *widget,
|
|||||||
gtk_snapshot_append_color (snapshot,
|
gtk_snapshot_append_color (snapshot,
|
||||||
&self->color,
|
&self->color,
|
||||||
&GRAPHENE_RECT_INIT (v->x * width,
|
&GRAPHENE_RECT_INIT (v->x * width,
|
||||||
height - line_height,
|
0,
|
||||||
line_width,
|
line_width,
|
||||||
line_height));
|
line_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_snapshot_restore (snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const SysprofXYSeriesValue *
|
static const SysprofXYSeriesValue *
|
||||||
|
|||||||
Reference in New Issue
Block a user