[gnome-builder] graph: keep surface around if width/height did not change
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] graph: keep surface around if width/height did not change
- Date: Sat, 20 Jun 2015 09:47:04 +0000 (UTC)
commit ecbfc94397744bf6f9a56533b0000eaf97c2943e
Author: Christian Hergert <christian hergert me>
Date: Wed Jun 17 16:46:06 2015 -0700
graph: keep surface around if width/height did not change
If only the X and Y coordinates changed, we can avoid redrawing the
graph surface.
We don't actually hit this today in Builder, because the GbWorkspace
works hard to not change the width/height when animating. Also, the
X/Y stays at 0,0 relative to its GdkWindow.
But good to add nonetheless.
contrib/rg/rg-graph.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/contrib/rg/rg-graph.c b/contrib/rg/rg-graph.c
index 90dac51..16ae525 100644
--- a/contrib/rg/rg-graph.c
+++ b/contrib/rg/rg-graph.c
@@ -259,11 +259,15 @@ rg_graph_size_allocate (GtkWidget *widget,
{
RgGraph *self = (RgGraph *)widget;
RgGraphPrivate *priv = rg_graph_get_instance_private (self);
+ GtkAllocation old_alloc;
g_assert (RG_IS_GRAPH (self));
g_assert (alloc != NULL);
- g_clear_pointer (&priv->surface, cairo_surface_destroy);
+ gtk_widget_get_allocation (widget, &old_alloc);
+
+ if ((old_alloc.width != alloc->width) || (old_alloc.height != alloc->height))
+ g_clear_pointer (&priv->surface, cairo_surface_destroy);
GTK_WIDGET_CLASS (rg_graph_parent_class)->size_allocate (widget, alloc);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]