[cairo-commit] goocanvas/src goocanvasellipseview.c, 1.3, 1.4 goocanvasgroupview.c, 1.3, 1.4 goocanvasimageview.c, 1.3, 1.4 goocanvasitemview.c, 1.3, 1.4 goocanvasitemview.h, 1.3, 1.4 goocanvaspolylineview.c, 1.3, 1.4 goocanvasrectview.c, 1.3, 1.4 goocanvastextview.c, 1.4, 1.5 goocanvasview.c, 1.5, 1.6 goocanvasview.h, 1.3, 1.4

Damon Chaplin commit at pdx.freedesktop.org
Fri Mar 24 09:32:24 PST 2006


Committed by: damon

Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv2716/src

Modified Files:
	goocanvasellipseview.c goocanvasgroupview.c 
	goocanvasimageview.c goocanvasitemview.c goocanvasitemview.h 
	goocanvaspolylineview.c goocanvasrectview.c 
	goocanvastextview.c goocanvasview.c goocanvasview.h 
Log Message:
2006-03-24  Damon Chaplin  <damon at gnome.org>

	* src/goocanvasitemview.c (goo_canvas_item_view_ensure_updated): new
	convenience function to do an immediate update.

	* src/goocanvasview.c (goo_canvas_view_update): turned this into a
	public function for use by the above.

	* src/goocanvastextview.c (goo_canvas_text_view_get_bounds) 
	(goo_canvas_text_view_get_item_at): 
	* src/goocanvasrectview.c (goo_canvas_rect_view_get_bounds) 
	(goo_canvas_rect_view_get_item_at): 
	* src/goocanvaspolylineview.c (goo_canvas_polyline_view_get_bounds) 
	(goo_canvas_polyline_view_get_item_at): 
	* src/goocanvasgroupview.c (goo_canvas_group_view_get_bounds) 
	(goo_canvas_group_view_get_item_at): 
	* src/goocanvasimageview.c (goo_canvas_image_view_get_bounds) 
	(goo_canvas_image_view_get_item_at): 
	* src/goocanvasellipseview.c (goo_canvas_ellipse_view_get_bounds) 
	(goo_canvas_ellipse_view_get_item_at): make sure the canvas is updated
	first, if needed.



Index: goocanvasellipseview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasellipseview.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvasellipseview.c	24 Mar 2006 16:55:45 -0000	1.3
+++ goocanvasellipseview.c	24 Mar 2006 17:32:22 -0000	1.4
@@ -110,6 +110,10 @@
 goo_canvas_ellipse_view_get_bounds  (GooCanvasItemView   *view)
 {
   GooCanvasEllipseView *ellipse_view = (GooCanvasEllipseView*) view;
+
+  if (ellipse_view->need_update)
+    goo_canvas_item_view_ensure_updated (view);
+    
   return &ellipse_view->bounds;
 }
 
@@ -125,6 +129,9 @@
   GooCanvasItemView *found_view = NULL;
   double user_x = x, user_y = y;
 
+  if (ellipse_view->need_update)
+    goo_canvas_item_view_ensure_updated (view);
+
   cairo_save (cr);
   if (simple->transform)
     cairo_transform (cr, simple->transform);

Index: goocanvasgroupview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasgroupview.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvasgroupview.c	24 Mar 2006 16:55:45 -0000	1.3
+++ goocanvasgroupview.c	24 Mar 2006 17:32:22 -0000	1.4
@@ -307,6 +307,10 @@
 goo_canvas_group_view_get_bounds  (GooCanvasItemView  *view)
 {
   GooCanvasGroupView *group_view = (GooCanvasGroupView*) view;
+
+  if (group_view->need_update)
+    goo_canvas_item_view_ensure_updated (view);
+
   return &group_view->bounds;
 }
 
@@ -322,6 +326,9 @@
   GooCanvasItemView *found_item = NULL;
   int i;
 
+  if (group_view->need_update)
+    goo_canvas_item_view_ensure_updated (view);
+
   /* Step down from the top item to the bottom in the stack/layer, and return
      the first item found that contains the given point. */
   cairo_save (cr);

Index: goocanvasimageview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasimageview.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvasimageview.c	24 Mar 2006 16:55:45 -0000	1.3
+++ goocanvasimageview.c	24 Mar 2006 17:32:22 -0000	1.4
@@ -96,6 +96,10 @@
 goo_canvas_image_view_get_bounds  (GooCanvasItemView   *view)
 {
   GooCanvasImageView *image_view = (GooCanvasImageView*) view;
+
+  if (image_view->need_update)
+    goo_canvas_item_view_ensure_updated (view);
+
   return &image_view->bounds;
 }
 
@@ -112,6 +116,9 @@
   GooCanvasItemView *found_view = view;
   double user_x = x, user_y = y;
 
+  if (image_view->need_update)
+    goo_canvas_item_view_ensure_updated (view);
+
   cairo_save (cr);
   if (simple->transform)
     cairo_transform (cr, simple->transform);

Index: goocanvasitemview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemview.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvasitemview.c	24 Mar 2006 16:55:45 -0000	1.3
+++ goocanvasitemview.c	24 Mar 2006 17:32:22 -0000	1.4
@@ -281,6 +281,17 @@
 }
 
 
+void
+goo_canvas_item_view_ensure_updated (GooCanvasItemView *view)
+{
+  GooCanvasView *canvas_view;
+
+  canvas_view = goo_canvas_item_view_get_canvas_view (view);
+  if (canvas_view)
+    goo_canvas_view_update (canvas_view);
+}
+
+
 GooCanvasBounds*
 goo_canvas_item_view_update      (GooCanvasItemView  *view,
 				  gboolean            entire_tree,

Index: goocanvasitemview.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitemview.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvasitemview.h	24 Mar 2006 16:55:45 -0000	1.3
+++ goocanvasitemview.h	24 Mar 2006 17:32:22 -0000	1.4
@@ -106,6 +106,7 @@
 						     gdouble             x,
 						     gdouble             y,
 						     cairo_t            *cr);
+void		   goo_canvas_item_view_ensure_updated (GooCanvasItemView *view);
 GooCanvasBounds*   goo_canvas_item_view_update      (GooCanvasItemView  *view,
 						     gboolean            entire_tree,
 						     cairo_t            *cr);

Index: goocanvaspolylineview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvaspolylineview.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvaspolylineview.c	24 Mar 2006 16:55:45 -0000	1.3
+++ goocanvaspolylineview.c	24 Mar 2006 17:32:22 -0000	1.4
@@ -179,6 +179,10 @@
 goo_canvas_polyline_view_get_bounds  (GooCanvasItemView   *view)
 {
   GooCanvasPolylineView *polyline_view = (GooCanvasPolylineView*) view;
+
+  if (polyline_view->need_update)
+    goo_canvas_item_view_ensure_updated (view);
+
   return &polyline_view->bounds;
 }
 
@@ -195,6 +199,9 @@
   GooCanvasItemView *found_view = NULL;
   double user_x = x, user_y = y;
 
+  if (polyline_view->need_update)
+    goo_canvas_item_view_ensure_updated (view);
+
   if (polyline->num_points == 0)
     return NULL;
 

Index: goocanvasrectview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasrectview.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvasrectview.c	24 Mar 2006 16:55:45 -0000	1.3
+++ goocanvasrectview.c	24 Mar 2006 17:32:22 -0000	1.4
@@ -206,6 +206,10 @@
 goo_canvas_rect_view_get_bounds  (GooCanvasItemView   *view)
 {
   GooCanvasRectView *rect_view = (GooCanvasRectView*) view;
+
+  if (rect_view->need_update)
+    goo_canvas_item_view_ensure_updated (view);
+
   return &rect_view->bounds;
 }
 
@@ -221,6 +225,9 @@
   GooCanvasItemView *found_view = NULL;
   double user_x = x, user_y = y;
 
+  if (rect_view->need_update)
+    goo_canvas_item_view_ensure_updated (view);
+
   cairo_save (cr);
   if (simple->transform)
     cairo_transform (cr, simple->transform);

Index: goocanvastextview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvastextview.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- goocanvastextview.c	24 Mar 2006 16:55:45 -0000	1.4
+++ goocanvastextview.c	24 Mar 2006 17:32:22 -0000	1.5
@@ -250,6 +250,10 @@
 goo_canvas_text_view_get_bounds  (GooCanvasItemView   *view)
 {
   GooCanvasTextView *text_view = (GooCanvasTextView*) view;
+
+  if (text_view->need_update)
+    goo_canvas_item_view_ensure_updated (view);
+
   return &text_view->bounds;
 }
 
@@ -270,6 +274,9 @@
   int px, py;
   double user_x = x, user_y = y;
 
+  if (text_view->need_update)
+    goo_canvas_item_view_ensure_updated (view);
+
   cairo_save (cr);
   if (simple->transform)
     cairo_transform (cr, simple->transform);

Index: goocanvasview.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasview.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- goocanvasview.c	24 Mar 2006 16:55:45 -0000	1.5
+++ goocanvasview.c	24 Mar 2006 17:32:22 -0000	1.6
@@ -51,8 +51,6 @@
 						 GdkEventFocus    *event);
 static gboolean goo_canvas_view_grab_broken     (GtkWidget        *widget,
 						 GdkEventGrabBroken *event);
-static void     goo_canvas_view_update          (GooCanvasView    *view,
-						 cairo_t          *expose_cr);
 
 static void     set_item_view_pointer           (GooCanvasItemView **view,
 						 GooCanvasItemView  *new_view);
@@ -186,7 +184,7 @@
 							  NULL);
 
       if (GTK_WIDGET_REALIZED (view))
-	goo_canvas_view_update (view, NULL);
+	goo_canvas_view_update (view);
     }
 
   gtk_widget_queue_draw (GTK_WIDGET (view));
@@ -262,7 +260,7 @@
   gtk_style_set_background (widget->style, view->canvas_window, GTK_STATE_NORMAL);
   gdk_window_set_back_pixmap (view->tmp_window, NULL, FALSE);
 
-  goo_canvas_view_update (GOO_CANVAS_VIEW (widget), NULL);
+  goo_canvas_view_update (GOO_CANVAS_VIEW (widget));
 }
 
 
@@ -782,16 +780,9 @@
 
 
 static void
-goo_canvas_view_update (GooCanvasView *view,
-			cairo_t       *expose_cr)
+goo_canvas_view_update_internal (GooCanvasView *view,
+				 cairo_t       *cr)
 {
-  cairo_t *cr;
-
-  if (expose_cr)
-    cr = expose_cr;
-  else
-    cr = goo_canvas_view_create_cairo (view);
-
   /* It is possible that processing the first set of updates causes other
      updates to be scheduled, so we loop round until all are done. Items
      should ensure that they don't cause this to loop forever. */
@@ -804,11 +795,15 @@
 
   /* Check which item view is under the pointer. */
   update_pointer_item_view (view, NULL);
+}
 
-  if (cr != expose_cr)
-    cairo_destroy (cr);
-  else
-    cairo_new_path (cr);
+
+void
+goo_canvas_view_update (GooCanvasView *view)
+{
+  cairo_t *cr = goo_canvas_view_create_cairo (view);
+  goo_canvas_view_update_internal (view, cr);
+  cairo_destroy (cr);
 }
 
 
@@ -817,7 +812,7 @@
 {
   GDK_THREADS_ENTER ();
 
-  goo_canvas_view_update (view, NULL);
+  goo_canvas_view_update (view);
 
   /* Reset idle id. Note that we do this after goo_canvas_view_update(), to
      make sure we don't schedule another idle handler while that is running. */
@@ -901,7 +896,7 @@
   cr = goo_canvas_view_create_cairo (view);
 
   if (view->need_update)
-    goo_canvas_view_update (view, cr);
+    goo_canvas_view_update_internal (view, cr);
 
   bounds.x1 = ((event->area.x - view->canvas_x_offset) / view->scale)
     + view->bounds.x1;

Index: goocanvasview.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasview.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- goocanvasview.h	24 Mar 2006 16:55:45 -0000	1.3
+++ goocanvasview.h	24 Mar 2006 17:32:22 -0000	1.4
@@ -191,6 +191,7 @@
 GooCanvasItemView* goo_canvas_view_create_item_view (GooCanvasView     *view,
 						     GooCanvasItem     *item,
 						     GooCanvasItemView *parent_view);
+void	      goo_canvas_view_update	     (GooCanvasView     *view);
 void          goo_canvas_view_request_update (GooCanvasView     *view);
 void          goo_canvas_view_request_redraw (GooCanvasView     *view,
 					      GooCanvasBounds   *bounds);



More information about the cairo-commit mailing list