[cairo-commit] goocanvas/src goocanvas.c, 1.24, 1.25 goocanvas.h, 1.15, 1.16

Damon Chaplin commit at pdx.freedesktop.org
Sun Nov 18 06:26:23 PST 2007


Committed by: damon

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

Modified Files:
	goocanvas.c goocanvas.h 
Log Message:
2007-11-18  Damon Chaplin  <damon at gnome.org>

	* src/goocanvas.c: added support for "clear-background" property,
	patch from Grahame Bowland.



Index: goocanvas.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvas.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- goocanvas.c	13 Nov 2007 14:30:52 -0000	1.24
+++ goocanvas.c	18 Nov 2007 14:26:20 -0000	1.25
@@ -124,7 +124,8 @@
   PROP_RESOLUTION_Y,
   PROP_BACKGROUND_COLOR,
   PROP_BACKGROUND_COLOR_RGB,
-  PROP_INTEGER_LAYOUT
+  PROP_INTEGER_LAYOUT, 
+  PROP_CLEAR_BACKGROUND
 };
 
 enum {
@@ -385,6 +386,13 @@
 							 FALSE,
 							 G_PARAM_READWRITE));
 
+  g_object_class_install_property (gobject_class, PROP_CLEAR_BACKGROUND, 
+                                   g_param_spec_boolean ("clear-background",
+							 _("Clear Background"),
+							 _("If the background is cleared before the canvas is painted"),
+							 TRUE,
+							 G_PARAM_READWRITE));
+
   /**
    * GooCanvas::set-scroll-adjustments
    * @canvas: the canvas.
@@ -446,6 +454,7 @@
   canvas->need_entire_subtree_update = TRUE;
   canvas->crossing_event.type = GDK_LEAVE_NOTIFY;
   canvas->anchor = GTK_ANCHOR_NORTH_WEST;
+  canvas->clear_background = TRUE;
 
   /* Set the default bounds to a reasonable size. */
   canvas->bounds.x1 = 0.0;
@@ -688,6 +697,9 @@
     case PROP_INTEGER_LAYOUT:
       g_value_set_boolean (value, canvas->integer_layout);
       break;
+    case PROP_CLEAR_BACKGROUND:
+      g_value_set_boolean (value, canvas->clear_background);
+      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -788,6 +800,9 @@
       canvas->need_entire_subtree_update = TRUE;
       goo_canvas_request_update (canvas);
       break;
+    case PROP_CLEAR_BACKGROUND:
+      canvas->clear_background = g_value_get_boolean (value);
+      break;
 
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -2221,10 +2236,13 @@
     return FALSE;
 
   /* Clear the background. */
-  gdk_draw_rectangle (canvas->canvas_window,
-		      widget->style->base_gc[widget->state], TRUE,
-		      event->area.x, event->area.y,
-		      event->area.width, event->area.height);
+  if (canvas->clear_background)
+    {
+      gdk_draw_rectangle (canvas->canvas_window,
+			  widget->style->base_gc[widget->state], TRUE,
+			  event->area.x, event->area.y,
+			  event->area.width, event->area.height);
+    }
 
   cr = goo_canvas_create_cairo_context (canvas);
 

Index: goocanvas.h
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvas.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- goocanvas.h	20 Jun 2007 12:59:48 -0000	1.15
+++ goocanvas.h	18 Nov 2007 14:26:21 -0000	1.16
@@ -80,6 +80,9 @@
   /* This is TRUE if the automatic bounds are calculated from the origin. */
   guint bounds_from_origin : 1;
 
+  /* This is TRUE if the background is cleared before painting the canvas. */
+  guint clear_background : 1;
+
   /* This is the padding around the automatic bounds. */
   gdouble bounds_padding;
 



More information about the cairo-commit mailing list