mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-gtk: break value at x,y coord into helper
This commit is contained in:
@ -91,13 +91,12 @@ sysprof_depth_layer_snapshot (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static const SysprofXYSeriesValue *
|
||||||
sysprof_depth_layer_snapshot_motion (SysprofChartLayer *layer,
|
sysprof_depth_layer_get_value_at_coord (SysprofDepthLayer *self,
|
||||||
GtkSnapshot *snapshot,
|
double x,
|
||||||
double x,
|
double y,
|
||||||
double y)
|
graphene_rect_t *area)
|
||||||
{
|
{
|
||||||
SysprofDepthLayer *self = (SysprofDepthLayer *)layer;
|
|
||||||
const SysprofXYSeriesValue *values;
|
const SysprofXYSeriesValue *values;
|
||||||
graphene_point_t point;
|
graphene_point_t point;
|
||||||
double min_x, max_x;
|
double min_x, max_x;
|
||||||
@ -108,17 +107,16 @@ sysprof_depth_layer_snapshot_motion (SysprofChartLayer *layer,
|
|||||||
int height;
|
int height;
|
||||||
|
|
||||||
g_assert (SYSPROF_IS_DEPTH_LAYER (self));
|
g_assert (SYSPROF_IS_DEPTH_LAYER (self));
|
||||||
g_assert (GTK_IS_SNAPSHOT (snapshot));
|
|
||||||
|
|
||||||
width = gtk_widget_get_width (GTK_WIDGET (self));
|
width = gtk_widget_get_width (GTK_WIDGET (self));
|
||||||
height = gtk_widget_get_height (GTK_WIDGET (self));
|
height = gtk_widget_get_height (GTK_WIDGET (self));
|
||||||
|
|
||||||
if (width == 0 || height == 0)
|
if (width == 0 || height == 0)
|
||||||
return;
|
return NULL;
|
||||||
|
|
||||||
if (self->series == NULL ||
|
if (self->series == NULL ||
|
||||||
!(values = sysprof_xy_series_get_values (self->series, &n_values)))
|
!(values = sysprof_xy_series_get_values (self->series, &n_values)))
|
||||||
return;
|
return NULL;
|
||||||
|
|
||||||
point = GRAPHENE_POINT_INIT (x, y);
|
point = GRAPHENE_POINT_INIT (x, y);
|
||||||
|
|
||||||
@ -137,10 +135,30 @@ sysprof_depth_layer_snapshot_motion (SysprofChartLayer *layer,
|
|||||||
|
|
||||||
if (graphene_rect_contains_point (&rect, &point))
|
if (graphene_rect_contains_point (&rect, &point))
|
||||||
{
|
{
|
||||||
gtk_snapshot_append_color (snapshot, &self->hover_color, &rect);
|
if (area != NULL)
|
||||||
break;
|
*area = rect;
|
||||||
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sysprof_depth_layer_snapshot_motion (SysprofChartLayer *layer,
|
||||||
|
GtkSnapshot *snapshot,
|
||||||
|
double x,
|
||||||
|
double y)
|
||||||
|
{
|
||||||
|
SysprofDepthLayer *self = (SysprofDepthLayer *)layer;
|
||||||
|
const SysprofXYSeriesValue *v;
|
||||||
|
graphene_rect_t rect;
|
||||||
|
|
||||||
|
g_assert (SYSPROF_IS_DEPTH_LAYER (self));
|
||||||
|
g_assert (GTK_IS_SNAPSHOT (snapshot));
|
||||||
|
|
||||||
|
if ((v = sysprof_depth_layer_get_value_at_coord (self, x, y, &rect)))
|
||||||
|
gtk_snapshot_append_color (snapshot, &self->hover_color, &rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user