[sysprof] ticks: don't draw final layout if there isn't space



commit 2d6906b542c6140352eb5c067227c01354bc0d21
Author: Christian Hergert <chergert redhat com>
Date:   Thu Aug 1 00:26:02 2019 -0700

    ticks: don't draw final layout if there isn't space
    
    This just helps keep things from geting cut off.

 src/libsysprof-ui/sysprof-visualizer-ticks.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/libsysprof-ui/sysprof-visualizer-ticks.c b/src/libsysprof-ui/sysprof-visualizer-ticks.c
index c136d02..030937c 100644
--- a/src/libsysprof-ui/sysprof-visualizer-ticks.c
+++ b/src/libsysprof-ui/sysprof-visualizer-ticks.c
@@ -198,7 +198,9 @@ draw_ticks (SysprofVisualizerTicks *self,
           cairo_move_to (cr, (gint)x + 2.5 - (gint)half, 2);
           update_label_text (layout, t - begin_time, want_msec);
           pango_layout_get_pixel_size (layout, &w, &h);
-          pango_cairo_show_layout (cr, layout);
+
+          if (x + w <= alloc.width)
+            pango_cairo_show_layout (cr, layout);
 
           last_x2 = x + w;
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]