mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-ui: improve marks drawing a bit
This commit is contained in:
@ -65,14 +65,11 @@ sysprof_cell_renderer_duration_render (GtkCellRenderer *renderer,
|
|||||||
g_assert (cr != NULL);
|
g_assert (cr != NULL);
|
||||||
g_assert (GTK_IS_WIDGET (widget));
|
g_assert (GTK_IS_WIDGET (widget));
|
||||||
|
|
||||||
if (priv->begin_time == priv->end_time)
|
if (priv->end_time >= priv->begin_time)
|
||||||
return;
|
{
|
||||||
|
if (priv->begin_time > priv->zoom_end || priv->end_time < priv->zoom_begin)
|
||||||
if (priv->end_time < priv->begin_time)
|
return;
|
||||||
return;
|
}
|
||||||
|
|
||||||
if (priv->begin_time > priv->zoom_end || priv->end_time < priv->zoom_begin)
|
|
||||||
return;
|
|
||||||
|
|
||||||
style_context = gtk_widget_get_style_context (widget);
|
style_context = gtk_widget_get_style_context (widget);
|
||||||
gtk_style_context_get_color (style_context,
|
gtk_style_context_get_color (style_context,
|
||||||
@ -84,6 +81,9 @@ sysprof_cell_renderer_duration_render (GtkCellRenderer *renderer,
|
|||||||
x1 = (priv->begin_time - priv->zoom_begin) / zoom_range * cell_area->width;
|
x1 = (priv->begin_time - priv->zoom_begin) / zoom_range * cell_area->width;
|
||||||
x2 = (priv->end_time - priv->zoom_begin) / zoom_range * cell_area->width;
|
x2 = (priv->end_time - priv->zoom_begin) / zoom_range * cell_area->width;
|
||||||
|
|
||||||
|
if (x2 < x1)
|
||||||
|
x2 = x1;
|
||||||
|
|
||||||
r.x = cell_area->x + x1;
|
r.x = cell_area->x + x1;
|
||||||
r.y = cell_area->y;
|
r.y = cell_area->y;
|
||||||
r.width = MAX (1.0, x2 - x1);
|
r.width = MAX (1.0, x2 - x1);
|
||||||
|
|||||||
@ -294,10 +294,14 @@ item_compare (gconstpointer a,
|
|||||||
const Item *ia = a;
|
const Item *ia = a;
|
||||||
const Item *ib = b;
|
const Item *ib = b;
|
||||||
|
|
||||||
if (ia->begin_time == ib->begin_time)
|
if (ia->begin_time < ib->begin_time)
|
||||||
return ia->end_time - ib->end_time;
|
return -1;
|
||||||
|
else if (ia->begin_time > ib->begin_time)
|
||||||
return ia->begin_time - ib->begin_time;
|
return 1;
|
||||||
|
else if (ia->end_time > ib->end_time)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user