[evolution/gtk3] Use cairo_t for GnomeCanvasItem's draw methods



commit 34c54571481f0d215d91988175bc3d00a486c812
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Fri Dec 10 13:07:13 2010 +0100

    Use cairo_t for GnomeCanvasItem's draw methods

 libgnomecanvas/gnome-canvas-pixbuf.c |    2 --
 libgnomecanvas/gnome-canvas-rect.c   |    6 +-----
 libgnomecanvas/gnome-canvas-text.c   |    8 ++------
 libgnomecanvas/gnome-canvas-widget.c |    4 ++--
 4 files changed, 5 insertions(+), 15 deletions(-)
---
diff --git a/libgnomecanvas/gnome-canvas-pixbuf.c b/libgnomecanvas/gnome-canvas-pixbuf.c
index 54c2d24..3cfefdb 100644
--- a/libgnomecanvas/gnome-canvas-pixbuf.c
+++ b/libgnomecanvas/gnome-canvas-pixbuf.c
@@ -286,8 +286,6 @@ gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, cairo_t *cr,
 
         gdk_cairo_set_source_pixbuf (cr, priv->pixbuf, 0, 0);
         cairo_paint (cr);
-
-        cairo_destroy (cr);
 }
 
 
diff --git a/libgnomecanvas/gnome-canvas-rect.c b/libgnomecanvas/gnome-canvas-rect.c
index aa1399b..5d98136 100644
--- a/libgnomecanvas/gnome-canvas-rect.c
+++ b/libgnomecanvas/gnome-canvas-rect.c
@@ -392,7 +392,7 @@ gnome_canvas_rect_update (GnomeCanvasItem *item,
 
 static void
 gnome_canvas_rect_draw (GnomeCanvasItem *item,
-                        GdkDrawable *drawable,
+                        cairo_t *cr,
                         gint x,
                         gint y,
                         gint width,
@@ -400,10 +400,8 @@ gnome_canvas_rect_draw (GnomeCanvasItem *item,
 {
 	GnomeCanvasRect *rect;
 	cairo_matrix_t matrix;
-	cairo_t *cr;
 
 	rect = GNOME_CANVAS_RECT (item);
-	cr = gdk_cairo_create (drawable);
 
 	gnome_canvas_item_i2c_matrix (item, &matrix);
 	cairo_transform (cr, &matrix);
@@ -420,8 +418,6 @@ gnome_canvas_rect_draw (GnomeCanvasItem *item,
 
 	if (gnome_canvas_rect_setup_for_stroke (rect, cr))
 		cairo_stroke_preserve (cr);
-
-	cairo_destroy (cr);
 }
 
 static GnomeCanvasItem *
diff --git a/libgnomecanvas/gnome-canvas-text.c b/libgnomecanvas/gnome-canvas-text.c
index 870b327..33dee52 100644
--- a/libgnomecanvas/gnome-canvas-text.c
+++ b/libgnomecanvas/gnome-canvas-text.c
@@ -106,7 +106,7 @@ static void gnome_canvas_text_get_property (GObject            *object,
 					    GParamSpec         *pspec);
 
 static void gnome_canvas_text_update (GnomeCanvasItem *item, const cairo_matrix_t *matrix, gint flags);
-static void gnome_canvas_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
+static void gnome_canvas_text_draw (GnomeCanvasItem *item, cairo_t *cr,
 				    gint x, gint y, gint width, gint height);
 static GnomeCanvasItem *gnome_canvas_text_point (GnomeCanvasItem *item,
                                                  gdouble x,
@@ -1189,16 +1189,14 @@ gnome_canvas_text_update (GnomeCanvasItem *item,
 
 /* Draw handler for the text item */
 static void
-gnome_canvas_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
+gnome_canvas_text_draw (GnomeCanvasItem *item, cairo_t *cr,
 			gint x, gint y, gint width, gint height)
 {
 	GnomeCanvasText *text = GNOME_CANVAS_TEXT (item);
-        cairo_t *cr;
 
 	if (!text->text)
 		return;
 
-        cr = gdk_cairo_create (drawable);
         if (text->clip) {
                 cairo_rectangle (cr,
                                  text->clip_cx - x,
@@ -1216,8 +1214,6 @@ gnome_canvas_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
 
         cairo_move_to (cr, text->cx - x, text->cy - y);
         pango_cairo_show_layout (cr, text->layout);
-
-        cairo_destroy (cr);
 }
 
 /* Point handler for the text item */
diff --git a/libgnomecanvas/gnome-canvas-widget.c b/libgnomecanvas/gnome-canvas-widget.c
index d6ac27c..e4ad958 100644
--- a/libgnomecanvas/gnome-canvas-widget.c
+++ b/libgnomecanvas/gnome-canvas-widget.c
@@ -73,7 +73,7 @@ static void	gnome_canvas_widget_bounds	(GnomeCanvasItem *item,
 						 gdouble *y2);
 
 static void	gnome_canvas_widget_draw	(GnomeCanvasItem *item,
-						 GdkDrawable *drawable,
+						 cairo_t *cr,
 						 gint x,
 						 gint y,
 						 gint width,
@@ -407,7 +407,7 @@ gnome_canvas_widget_update (GnomeCanvasItem *item,
 
 static void
 gnome_canvas_widget_draw (GnomeCanvasItem *item,
-			  GdkDrawable *drawable,
+			  cairo_t *cr,
 			  gint x, gint y,
 			  gint width, gint height)
 {



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