mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 15:10:53 +00:00
libsysprof-ui: add dashed line support
This commit is contained in:
@ -79,6 +79,7 @@ typedef struct
|
|||||||
GdkRGBA background;
|
GdkRGBA background;
|
||||||
guint use_default_style : 1;
|
guint use_default_style : 1;
|
||||||
guint fill : 1;
|
guint fill : 1;
|
||||||
|
guint use_dash : 1;
|
||||||
} LineInfo;
|
} LineInfo;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -113,6 +114,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static GParamSpec *properties [N_PROPS];
|
static GParamSpec *properties [N_PROPS];
|
||||||
|
static gdouble dashes[] = { 1.0, 2.0 };
|
||||||
|
|
||||||
static void
|
static void
|
||||||
load_data_free (gpointer data)
|
load_data_free (gpointer data)
|
||||||
@ -223,6 +225,9 @@ sysprof_line_visualizer_row_draw (GtkWidget *widget,
|
|||||||
|
|
||||||
cairo_set_line_width (cr, line_info->line_width);
|
cairo_set_line_width (cr, line_info->line_width);
|
||||||
|
|
||||||
|
if (line_info->use_dash)
|
||||||
|
cairo_set_dash (cr, dashes, G_N_ELEMENTS (dashes), 0);
|
||||||
|
|
||||||
if (line_info->fill)
|
if (line_info->fill)
|
||||||
{
|
{
|
||||||
gdk_cairo_set_source_rgba (cr, &line_info->background);
|
gdk_cairo_set_source_rgba (cr, &line_info->background);
|
||||||
@ -818,3 +823,25 @@ sysprof_line_visualizer_row_set_fill (SysprofLineVisualizerRow *self,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sysprof_line_visualizer_row_set_dash (SysprofLineVisualizerRow *self,
|
||||||
|
guint counter_id,
|
||||||
|
gboolean use_dash)
|
||||||
|
{
|
||||||
|
SysprofLineVisualizerRowPrivate *priv = sysprof_line_visualizer_row_get_instance_private (self);
|
||||||
|
|
||||||
|
g_return_if_fail (SYSPROF_IS_LINE_VISUALIZER_ROW (self));
|
||||||
|
|
||||||
|
for (guint i = 0; i < priv->lines->len; i++)
|
||||||
|
{
|
||||||
|
LineInfo *info = &g_array_index (priv->lines, LineInfo, i);
|
||||||
|
|
||||||
|
if (info->id == counter_id)
|
||||||
|
{
|
||||||
|
info->use_dash = !!use_dash;
|
||||||
|
sysprof_line_visualizer_row_queue_reload (self);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -62,5 +62,9 @@ SYSPROF_AVAILABLE_IN_ALL
|
|||||||
void sysprof_line_visualizer_row_set_fill (SysprofLineVisualizerRow *self,
|
void sysprof_line_visualizer_row_set_fill (SysprofLineVisualizerRow *self,
|
||||||
guint counter_id,
|
guint counter_id,
|
||||||
const GdkRGBA *color);
|
const GdkRGBA *color);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
void sysprof_line_visualizer_row_set_dash (SysprofLineVisualizerRow *self,
|
||||||
|
guint counter_id,
|
||||||
|
gboolean use_dash);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
Reference in New Issue
Block a user