[goocanvas/new-api] 2010-06-30 Damon Chaplin <damon gnome org>



commit 21c28854b22b7c2bc7efeb300c771665448662e1
Author: Damon Chaplin <damon gnome org>
Date:   Wed Jun 30 15:10:15 2010 +0100

    2010-06-30  Damon Chaplin  <damon gnome org>
    
    	    * demo/scalability-demo.c: fixed the USE_PIXMAP test.

 ChangeLog               |    4 ++++
 demo/scalability-demo.c |   18 ++++++++++++++----
 src/goocanvasgroup.c    |    8 ++++++++
 3 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6eca42a..b68dd22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-06-30  Damon Chaplin  <damon gnome org>
 
+	* demo/scalability-demo.c: fixed the USE_PIXMAP test.
+
+2010-06-30  Damon Chaplin  <damon gnome org>
+
 	* src/goocanvasitemsimple.c (goo_canvas_item_simple_set_property): if
 	a shared style is being used, make a copy of it before setting the
 	property.
diff --git a/demo/scalability-demo.c b/demo/scalability-demo.c
index 67d72b5..d4058ef 100644
--- a/demo/scalability-demo.c
+++ b/demo/scalability-demo.c
@@ -1,6 +1,7 @@
 #include <math.h>
 #include <stdlib.h>
 #include <goocanvas.h>
+#include "goocanvasprivate.h"
 
 #if 1
 #define N_GROUP_COLS 25
@@ -125,6 +126,9 @@ setup_canvas (GtkWidget *canvas)
   GQuark id_quark = g_quark_from_static_string ("id");
 
   root = goo_canvas_get_root_item (GOO_CANVAS (canvas));
+#ifdef SET_IDS
+  g_object_set_data ((GObject*) root, "id", "root");
+#endif
 
   g_signal_connect (root, "motion_notify_event",
 		    G_CALLBACK (on_motion_notify), NULL);
@@ -166,10 +170,14 @@ setup_canvas (GtkWidget *canvas)
 
 #ifdef USE_PIXMAP
 		  item = goo_canvas_image_new (group, NULL, item_x, item_y,
-					       "pattern", pattern,
-					       "width", item_width,
-					       "height", item_height,
+					       /*"pattern", pattern,*/
+					       /*"width", item_width,*/
+					       /*"height", item_height,*/
 					       NULL);
+		  /* FIXME: This is slightly naughty, but much faster. */
+		  GOO_CANVAS_IMAGE (item)->pattern = cairo_pattern_reference (pattern);
+		  GOO_CANVAS_IMAGE (item)->width = item_width;
+		  GOO_CANVAS_IMAGE (item)->height = item_height;
 #else
 		  item = goo_canvas_rect_new (group, item_x, item_y,
 					      item_width, item_height,
@@ -177,6 +185,8 @@ setup_canvas (GtkWidget *canvas)
 #ifdef SET_STYLE
 		  goo_canvas_item_simple_set_style ((GooCanvasItemSimple*) item, (j % 2) ? style : style2);
 #endif
+#endif
+
 #ifdef ROTATE
 		  cairo_matrix_init_identity (&item_matrix);
 		  cairo_matrix_translate (&item_matrix, rotation_x, rotation_y);
@@ -184,7 +194,7 @@ setup_canvas (GtkWidget *canvas)
 		  cairo_matrix_translate (&item_matrix, -rotation_x, -rotation_y);
 		  goo_canvas_item_set_transform (item, &item_matrix);
 #endif
-#endif
+
 #ifdef SET_IDS
 		  g_object_set_qdata (G_OBJECT (item), id_quark,
 				      ids[id_item_num]);
diff --git a/src/goocanvasgroup.c b/src/goocanvasgroup.c
index fa34f8b..69712b3 100644
--- a/src/goocanvasgroup.c
+++ b/src/goocanvasgroup.c
@@ -229,6 +229,14 @@ goo_canvas_group_update  (GooCanvasItem   *item,
 	}
     }
 
+#if 0
+  g_print ("Group '%s' bounds with children: %g, %g  %g x %g\n",
+	   (gchar*) g_object_get_data (G_OBJECT (simple), "id"),
+	   simple->bounds.x1, simple->bounds.y1,
+	   simple->bounds.x2 - simple->bounds.x1,
+	   simple->bounds.y2 - simple->bounds.y1);
+#endif
+
   *bounds = simple->bounds;
 }
 



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