[libchamplain] Clear textures before drawing



commit 020c514dd12a3b254e3ed22a8b80404e715f1239
Author: JiÅ?í Techet <techet gmail com>
Date:   Fri Feb 18 16:40:32 2011 +0100

    Clear textures before drawing

 champlain/champlain-label.c      |    8 ++++++++
 champlain/champlain-path-layer.c |    7 +++----
 champlain/champlain-point.c      |    4 ++++
 champlain/champlain-scale.c      |    6 +++++-
 demos/animated-marker.c          |    4 ++++
 5 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/champlain/champlain-label.c b/champlain/champlain-label.c
index 1e4ad7c..d822c1e 100644
--- a/champlain/champlain-label.c
+++ b/champlain/champlain-label.c
@@ -558,6 +558,10 @@ draw_shadow (ChamplainLabel *label,
   shadow = clutter_cairo_texture_new (width + x, (height + point));
   cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (shadow));
 
+  cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+  cairo_paint(cr);
+  cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+
   cairo_matrix_init (&matrix,
       1, 0,
       slope, scaling,
@@ -602,6 +606,10 @@ draw_background (ChamplainLabel *label,
   bg = clutter_cairo_texture_new (width, height + point);
   cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (bg));
 
+  cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+  cairo_paint(cr);
+  cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+
   /* If selected, add the selection color to the marker's color */
   if (champlain_marker_get_selected (marker))
     color = champlain_marker_get_selection_color ();
diff --git a/champlain/champlain-path-layer.c b/champlain/champlain-path-layer.c
index 773030c..b377f44 100644
--- a/champlain/champlain-path-layer.c
+++ b/champlain/champlain-path-layer.c
@@ -697,12 +697,11 @@ redraw_path (ChamplainPathLayer *layer)
 
   cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (priv->path_actor));
 
-  /* Clear the drawing area */
+  /* Clear the drawing area */  
   cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
-  cairo_rectangle (cr, 0, 0, width, height);
-  cairo_fill (cr);
-
+  cairo_paint(cr);
   cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+  
   for (elem = priv->nodes; elem != NULL; elem = elem->next)
     {
       ChamplainLocation *location = CHAMPLAIN_LOCATION (elem->data);
diff --git a/champlain/champlain-point.c b/champlain/champlain-point.c
index a857cfc..446075b 100644
--- a/champlain/champlain-point.c
+++ b/champlain/champlain-point.c
@@ -219,6 +219,10 @@ draw_point (ChamplainPoint *point)
 
   cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (cairo_texture));
 
+  cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+  cairo_paint(cr);
+  cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+
   if (champlain_marker_get_selected (CHAMPLAIN_MARKER (point)))
     color = champlain_marker_get_selection_color ();
   else
diff --git a/champlain/champlain-scale.c b/champlain/champlain-scale.c
index c37f511..d14b7df 100644
--- a/champlain/champlain-scale.c
+++ b/champlain/champlain-scale.c
@@ -332,9 +332,12 @@ redraw_scale (ChamplainScale *scale)
 
   /* Draw the line */
   line = clutter_container_find_child_by_name (CLUTTER_CONTAINER (priv->content_group), "scale-line");
-  clutter_cairo_texture_clear (CLUTTER_CAIRO_TEXTURE (line));
   cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (line));
 
+  cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+  cairo_paint(cr);
+  cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+
   cairo_set_source_rgb (cr, 0, 0, 0);
   cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
   cairo_set_line_width (cr, SCALE_LINE_WIDTH);
@@ -362,6 +365,7 @@ redraw_scale (ChamplainScale *scale)
   cairo_stroke (cr);
 
   cairo_destroy (cr);
+  clutter_actor_queue_redraw (CLUTTER_ACTOR (scale));
 }
 
 
diff --git a/demos/animated-marker.c b/demos/animated-marker.c
index 22660bd..26c1c86 100644
--- a/demos/animated-marker.c
+++ b/demos/animated-marker.c
@@ -41,6 +41,10 @@ create_marker ()
   bg = clutter_cairo_texture_new (MARKER_SIZE, MARKER_SIZE);
   cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (bg));
 
+  cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+  cairo_paint(cr);
+  cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+
   /* Draw the circle */
   cairo_set_source_rgb (cr, 0, 0, 0);
   cairo_arc (cr, MARKER_SIZE / 2.0, MARKER_SIZE / 2.0, MARKER_SIZE / 2.0, 0, 2 * M_PI);



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