line-visualizer-row: only queue draw when using widget style

We can avoid queuing a new draw request if we are not using
the default styling of the widget in the line drawing.
This commit is contained in:
Christian Hergert
2016-09-27 18:30:55 -07:00
parent 21db65167f
commit 21ed742215

View File

@ -421,12 +421,26 @@ static void
sp_line_visualizer_row_style_updated (GtkWidget *widget)
{
SpLineVisualizerRow *self = (SpLineVisualizerRow *)widget;
SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
g_assert (SP_IS_LINE_VISUALIZER_ROW (self));
GTK_WIDGET_CLASS (sp_line_visualizer_row_parent_class)->style_updated (widget);
sp_line_visualizer_row_begin_offscreen_draw (self);
/*
* Only queue a draw if a line that is drawn relies on the the style context
* of the widget (as opposed to a style set manually).
*/
for (guint i = 0; i < priv->lines->len; i++)
{
const LineInfo *line_info = &g_array_index (priv->lines, LineInfo, i);
if (line_info->use_default_style)
{
sp_line_visualizer_row_begin_offscreen_draw (self);
break;
}
}
}