[sysprof] libsysprof-ui: improve marks drawing a bit
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] libsysprof-ui: improve marks drawing a bit
- Date: Wed, 29 May 2019 22:25:03 +0000 (UTC)
commit 4af22435db01cecac4fc8d82c59bb06280a3e2be
Author: Christian Hergert <chergert redhat com>
Date: Mon May 13 00:38:15 2019 -0700
libsysprof-ui: improve marks drawing a bit
src/libsysprof-ui/sysprof-cell-renderer-duration.c | 16 ++++++++--------
src/libsysprof-ui/sysprof-marks-model.c | 12 ++++++++----
2 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-cell-renderer-duration.c
b/src/libsysprof-ui/sysprof-cell-renderer-duration.c
index fc26ffa..94bd7b7 100644
--- a/src/libsysprof-ui/sysprof-cell-renderer-duration.c
+++ b/src/libsysprof-ui/sysprof-cell-renderer-duration.c
@@ -65,14 +65,11 @@ sysprof_cell_renderer_duration_render (GtkCellRenderer *renderer,
g_assert (cr != NULL);
g_assert (GTK_IS_WIDGET (widget));
- if (priv->begin_time == priv->end_time)
- return;
-
- if (priv->end_time < priv->begin_time)
- return;
-
- if (priv->begin_time > priv->zoom_end || priv->end_time < priv->zoom_begin)
- return;
+ if (priv->end_time >= priv->begin_time)
+ {
+ if (priv->begin_time > priv->zoom_end || priv->end_time < priv->zoom_begin)
+ return;
+ }
style_context = gtk_widget_get_style_context (widget);
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;
x2 = (priv->end_time - priv->zoom_begin) / zoom_range * cell_area->width;
+ if (x2 < x1)
+ x2 = x1;
+
r.x = cell_area->x + x1;
r.y = cell_area->y;
r.width = MAX (1.0, x2 - x1);
diff --git a/src/libsysprof-ui/sysprof-marks-model.c b/src/libsysprof-ui/sysprof-marks-model.c
index 139c8ea..17ee2cf 100644
--- a/src/libsysprof-ui/sysprof-marks-model.c
+++ b/src/libsysprof-ui/sysprof-marks-model.c
@@ -294,10 +294,14 @@ item_compare (gconstpointer a,
const Item *ia = a;
const Item *ib = b;
- if (ia->begin_time == ib->begin_time)
- return ia->end_time - ib->end_time;
-
- return ia->begin_time - ib->begin_time;
+ if (ia->begin_time < ib->begin_time)
+ return -1;
+ else if (ia->begin_time > ib->begin_time)
+ return 1;
+ else if (ia->end_time > ib->end_time)
+ return 1;
+ else
+ return 0;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]