[gtk+/rendering-cleanup: 56/76] cellview: Port to Cairo rendering



commit 815e10e5b108fc79996952e9c3e57bc8ab933f10
Author: Benjamin Otte <otte redhat com>
Date:   Sun Aug 22 04:32:39 2010 +0200

    cellview: Port to Cairo rendering

 gtk/gtkcellview.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c
index 305e7e7..475a9f1 100644
--- a/gtk/gtkcellview.c
+++ b/gtk/gtkcellview.c
@@ -436,27 +436,27 @@ gtk_cell_view_expose (GtkWidget      *widget,
   GtkCellRendererState state;
   gboolean rtl = (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL);
   GtkPackType packing;
-  
+  cairo_t *cr;
+
   cellview = GTK_CELL_VIEW (widget);
 
   if (!gtk_widget_is_drawable (widget))
     return FALSE;
 
   gtk_widget_get_allocation (widget, &allocation);
+  cr = gdk_cairo_create (event->window);
+  gdk_cairo_region (cr, event->region);
+  cairo_clip (cr);
 
   /* "blank" background */
   if (cellview->priv->background_set)
     {
-      cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (GTK_WIDGET (cellview)));
-
       gdk_cairo_rectangle (cr, &allocation);
       cairo_set_source_rgb (cr,
 			    cellview->priv->background.red / 65535.,
 			    cellview->priv->background.green / 65535.,
 			    cellview->priv->background.blue / 65535.);
       cairo_fill (cr);
-
-      cairo_destroy (cr);
     }
 
   /* set cell data (if available) */
@@ -501,11 +501,11 @@ gtk_cell_view_expose (GtkWidget      *widget,
 	      (packing == GTK_PACK_END && !rtl))
 	    area.x -= area.width;
 
-	  gtk_cell_renderer_render (info->cell,
-				    event->window,
-				    widget,
-				    /* FIXME! */
-				    &area, &area, &event->area, state);
+	  gtk_cell_renderer_render_cairo (info->cell,
+                                          cr,
+                                          widget,
+                                          /* FIXME! */
+                                          &area, &area, state);
 
 	  if ((packing == GTK_PACK_START && !rtl) ||
 	      (packing == GTK_PACK_END && rtl))
@@ -518,6 +518,8 @@ gtk_cell_view_expose (GtkWidget      *widget,
 	}
     }
 
+  cairo_destroy (cr);
+
   return FALSE;
 }
 



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