[gtksourceview/wip/test-gutter-perfs] test gutter perfs



commit 575a3d08df60c1702bb14e3799d7efce43cbe62f
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Sep 12 18:03:33 2014 +0200

    test gutter perfs

 gtksourceview/gtksourcegutter.c |   41 ++++----------------------------------
 1 files changed, 5 insertions(+), 36 deletions(-)
---
diff --git a/gtksourceview/gtksourcegutter.c b/gtksourceview/gtksourcegutter.c
index 978a5e0..3be2e1e 100644
--- a/gtksourceview/gtksourcegutter.c
+++ b/gtksourceview/gtksourcegutter.c
@@ -395,48 +395,13 @@ calculate_gutter_size (GtkSourceGutter  *gutter,
 }
 
 static void
-window_invalidate_handler (GdkWindow      *window,
-                          cairo_region_t *region)
-{
-       cairo_rectangle_int_t rect;
-
-       /* Always invalidate the whole window.
-        * When the text is modified in a GtkTextBuffer, GtkTextView tries to
-        * redraw the smallest required region. But the information displayed in
-        * the gutter may become invalid in a bigger region.
-        * See https://bugzilla.gnome.org/show_bug.cgi?id=732418 for an example
-        * where line numbers are not updated correctly when splitting a wrapped
-        * line.
-        * The performances should not be a big problem here. Correctness is
-        * more important than performances.
-        */
-
-       rect.x = 0;
-       rect.y = 0;
-       rect.width = gdk_window_get_width (window);
-       rect.height = gdk_window_get_height (window);
-
-       cairo_region_union_rectangle (region, &rect);
-}
-
-static void
 update_gutter_size (GtkSourceGutter *gutter)
 {
-       gint width;
-       GdkWindow *window;
-
-       width = calculate_gutter_size (gutter, NULL);
+       gint width = calculate_gutter_size (gutter, NULL);
 
        gtk_text_view_set_border_window_size (GTK_TEXT_VIEW (gutter->priv->view),
                                              gutter->priv->window_type,
                                              width);
-
-       window = get_window (gutter);
-
-       if (window != NULL)
-       {
-               gdk_window_set_invalidate_handler (window, window_invalidate_handler);
-       }
 }
 
 static gboolean
@@ -976,6 +941,10 @@ on_view_draw (GtkSourceView   *view,
 
        gutter->priv->is_drawing = TRUE;
 
+       static gint nb_draws = 1;
+       g_print ("draw gutter: %d\n", nb_draws);
+       nb_draws++;
+
        text_view = GTK_TEXT_VIEW (view);
        buffer = gtk_text_view_get_buffer (text_view);
 


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