[gnumeric] GUI: Improve performance of ant-ing a region.



commit c6ba34df8198d5622c8c22cac0ad537a5ef53faf
Author: Morten Welinder <terra gnome org>
Date:   Tue Jan 21 18:46:53 2014 -0500

    GUI: Improve performance of ant-ing a region.
    
    We used to redraw all (visible?) cells in the range.  With zoom and a large
    screen that can be quite a lot.

 ChangeLog         |    7 +++++++
 NEWS              |    1 +
 src/item-cursor.c |   15 +++++++++++++++
 3 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 877c7ba..0a51c20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-01-21  Morten Welinder  <terra gnome org>
+
+       * src/item-cursor.c (cb_item_cursor_animation): Drastically lower
+       the amount of work we do for ant-ing.  Fixes #381011, patch from
+       Jean.
+       (ic_reload_style): Ignore alpha component of ant colours.
+
 2014-01-17  Jean Brefort  <jean brefort normalesup org>
 
        * src/graph.c (gnm_go_data_vector_load_len),
diff --git a/NEWS b/NEWS
index c9784d8..cce12cf 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Andreas:
 
 Jean:
        * Accept 3D values for vector data. [#722294]
+       * Improve performance of ant-int cursor.  [#381011]
 
 Mario Rugiero:
        * Fix leaks.  [#720306]
diff --git a/src/item-cursor.c b/src/item-cursor.c
index 6be64a7..7933222 100644
--- a/src/item-cursor.c
+++ b/src/item-cursor.c
@@ -124,6 +124,11 @@ ic_reload_style (GnmItemCursor *ic)
        gtk_style_context_get_background_color (context, state,
                                                &ic->ant_background_color);
        gtk_style_context_restore (context);
+       /*
+        * Ensure we don't use transparency to avoid compositing issues
+        * when redrawing the ants in the timer callback.
+        */
+       ic->ant_color.alpha = ic->ant_background_color.alpha = 1.;
 
        gtk_style_context_save (context);
        gtk_style_context_add_class (context, "drag");
@@ -145,8 +150,18 @@ cb_item_cursor_animation (GnmItemCursor *ic)
 {
        GocItem *item = GOC_ITEM (ic);
 
+#if GTK_CHECK_VERSION(3,8,0)
+       GdkWindow *w = gtk_widget_get_window (GTK_WIDGET (item->canvas));
+       cairo_t *cr = gdk_cairo_create (w);
+
+       ic->state = !ic->state;
+       goc_item_draw (item, cr);
+       cairo_destroy (cr);
+#else
+       /* Somehow the above doesn't work.  */
        ic->state = !ic->state;
        goc_item_invalidate (item);
+#endif
        return TRUE;
 }
 


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