[graph-gtk] Fixed bug where nodes would sometimes disappear when a node is selected with no image data



commit c1740bc276fd8907dca38d7a59b7d939124e827f
Author: Isaac Wagner <isaacbw src gnome org>
Date:   Tue Aug 7 11:54:50 2012 -0400

    Fixed bug where nodes would sometimes disappear when a node is selected with no image data

 graph-gtk/graph-gtk-view.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/graph-gtk/graph-gtk-view.c b/graph-gtk/graph-gtk-view.c
index 8364dd0..5b9fd20 100644
--- a/graph-gtk/graph-gtk-view.c
+++ b/graph-gtk/graph-gtk-view.c
@@ -187,20 +187,22 @@ graph_gtk_view_draw(GtkWidget *widget, cairo_t* cr)
       gdouble bg_w = cairo_image_surface_get_width(view->bg);
       gdouble bg_h = cairo_image_surface_get_height(view->bg);
 
+      if(bg_w > 0 && bg_h > 0)
+	{
+	  gint width = gdk_window_get_width(widget->window);
+	  gint height = gdk_window_get_height(widget->window);
 
-      gint width = gdk_window_get_width(widget->window);
-      gint height = gdk_window_get_height(widget->window);
-
-      cairo_pattern_t *pattern = cairo_pattern_create_for_surface(view->bg);
-      cairo_matrix_t transform;
-      cairo_matrix_init_translate(&transform, -(width/2-bg_w/2), -(height/2-bg_h/2));
-      cairo_pattern_set_matrix(pattern, &transform);
+	  cairo_pattern_t *pattern = cairo_pattern_create_for_surface(view->bg);
+	  cairo_matrix_t transform;
+	  cairo_matrix_init_translate(&transform, -(width/2-bg_w/2), -(height/2-bg_h/2));
+	  cairo_pattern_set_matrix(pattern, &transform);
 
-      cairo_set_source(cr, pattern);
-      cairo_rectangle(cr, width/2-bg_w/2, height/2-bg_h/2, bg_w, bg_h);
-      cairo_fill(cr);
+	  cairo_set_source(cr, pattern);
+	  cairo_rectangle(cr, width/2-bg_w/2, height/2-bg_h/2, bg_w, bg_h);
+	  cairo_fill(cr);
 
-      cairo_pattern_destroy(pattern);
+	  cairo_pattern_destroy(pattern);
+	}
     }
 
   cairo_translate(cr, -view->pan_x, -view->pan_y);



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