[cairo-commit] goocanvas/demo scalability-demo.c,1.7,1.8

Damon Chaplin commit at pdx.freedesktop.org
Sun Feb 25 09:38:03 PST 2007


Committed by: damon

Update of /cvs/cairo/goocanvas/demo
In directory kemper:/tmp/cvs-serv11858/demo

Modified Files:
	scalability-demo.c 
Log Message:
2007-02-25  Damon Chaplin  <damon at gnome.org>

	* src/*.c: checked over all finalize methods and moved code to dispose
	methods where appropriate. (Dispose methods should be used to unref
	any other objects.) This was done to help the Ruby bindings.
	It was a bit fiddly so it might cause a few bugs.

	* src/goocanvasutils.c (goo_cairo_matrix_copy) 
	(goo_cairo_matrix_free): allocate and free with g_slice_new/free() as
	that is what was being used in GooCanvasItemSimple.

	* demo/scalability-demo.c: added a test for a very wide canvas, almost
	up to the 31-bit GDK window size limit. (It is slow to start though.)



Index: scalability-demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/scalability-demo.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- scalability-demo.c	24 Feb 2007 11:16:36 -0000	1.7
+++ scalability-demo.c	25 Feb 2007 17:37:57 -0000	1.8
@@ -1,22 +1,30 @@
 #include <stdlib.h>
 #include <goocanvas.h>
 
-#if 0
-#define N_GROUP_COLS 5
-#define N_GROUP_ROWS 5
-#else
+#if 1
 #define N_GROUP_COLS 25
 #define N_GROUP_ROWS 20
-#endif
 #define N_COLS 10
 #define N_ROWS 10
+#define ITEM_WIDTH 400
+#define PADDING 10
+#define ROTATE
+#else
+/* This tests a very wide canvas, nearly up to the 31-bit GDK window size
+   limit. */
+#define N_GROUP_COLS 100000
+#define N_GROUP_ROWS 1
+#define N_COLS 10
+#define N_ROWS 1
+#define ITEM_WIDTH 1000
+#define PADDING 100
+#endif
+
 #define N_TOTAL_ID_ITEMS (N_GROUP_COLS * N_GROUP_ROWS) * (N_COLS * N_ROWS)
 
 /* The maximum length of a string identifying an item (i.e. its coords). */
 #define MAX_ID_LEN 20
 
-#define PADDING 10
-
 #if 0
 #define USE_PIXMAP 
 #endif
@@ -73,7 +81,7 @@
   pattern = goo_canvas_cairo_pattern_from_pixbuf (pixbuf);
 #else
   pixbuf = NULL;
-  item_width = 400/*80*/;
+  item_width = ITEM_WIDTH;
   item_height = 19;
 #endif
 	
@@ -127,9 +135,11 @@
 		{
 		  double item_x = (i * cell_width) + PADDING;
 		  double item_y = (j * cell_height) + PADDING;
+#ifdef ROTATE
 		  double rotation = i % 10 * 2;
 		  double rotation_x = item_x + item_width / 2;
 		  double rotation_y = item_y + item_height / 2;
+#endif
 
 		  sprintf (ids[id_item_num], "%g, %g",
 			   group_x + item_x, group_y + item_y);
@@ -145,8 +155,10 @@
 					      item_width, item_height,
 					      NULL);
 		  goo_canvas_item_set_style (item, (j % 2) ? style : style2);
+#ifdef ROTATE
 		  goo_canvas_item_rotate (item, rotation, rotation_x, rotation_y);
 #endif
+#endif
 		  g_object_set_data (G_OBJECT (item), "id",
 				     ids[id_item_num]);
 
@@ -158,9 +170,10 @@
 					      item_y + item_height / 2,
 					      -1, GTK_ANCHOR_CENTER,
 					      NULL);
+#ifdef ROTATE
 		  goo_canvas_item_rotate (item, rotation, rotation_x,
 					  rotation_y);
-
+#endif
 		  id_item_num++;
 		  total_items += 2;
 



More information about the cairo-commit mailing list