]> Pileus Git - ~andy/gtk/commitdiff
treeview: Only compute parity once when rendering
authorBenjamin Otte <otte@redhat.com>
Thu, 7 Jul 2011 06:46:05 +0000 (08:46 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 16 Nov 2011 03:31:05 +0000 (04:31 +0100)
This shouldn't affect performance too much, but it I just found it so I
fixed it.

gtk/gtktreeview.c

index c1fe4014cc7f9772e2c0a2a1d2a0cdd7a7041740..ba269ea559fa44f6c636900bc400600bcef0d5c2 100644 (file)
@@ -4707,6 +4707,7 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
   gboolean draw_vgrid_lines, draw_hgrid_lines;
   GtkStyleContext *context;
   GtkStateFlags state;
+  gboolean parity;
 
   rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
   context = gtk_widget_get_style_context (widget);
@@ -4818,15 +4819,17 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
    * start at the first node of the event, and walk the tree in
    * order, drawing each successive node.
    */
+  
+  parity = !_gtk_rbtree_node_find_parity (tree, node);
 
   do
     {
-      gboolean parity;
       gboolean is_separator = FALSE;
       gboolean is_first = FALSE;
       gboolean is_last = FALSE;
       gint n_col = 0;
 
+      parity = !parity;
       is_separator = row_is_separator (tree_view, &iter, NULL);
 
       max_height = gtk_tree_view_get_row_height (tree_view, node);
@@ -4846,8 +4849,6 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
       if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
         flags |= GTK_CELL_RENDERER_SELECTED;
 
-      parity = _gtk_rbtree_node_find_parity (tree, node);
-
       /* we *need* to set cell data on all cells before the call
        * to _has_can_focus_cell, else _has_can_focus_cell() does not
        * return a correct value.