[gtk+] cellrendererpix: make the icon render properly again



commit 35fdce68e155765a131039c1a745c6b26d663338
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Jun 9 22:56:56 2011 -0400

    cellrendererpix: make the icon render properly again
    
    pix_rect was not initialized anymore, so the gdk_rectangle_intersect()
    call would always fail.

 gtk/gtkcellrendererpixbuf.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c
index 83e9352..73c36eb 100644
--- a/gtk/gtkcellrendererpixbuf.c
+++ b/gtk/gtkcellrendererpixbuf.c
@@ -748,15 +748,19 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer      *cell,
   GdkRectangle draw_rect;
   gboolean is_expander;
   gint xpad, ypad;
-  gint x, y;
   GtkStateFlags state;
 
   gtk_cell_renderer_pixbuf_get_size (cell, widget, (GdkRectangle *) cell_area,
-				     &x, &y, NULL, NULL);
+				     &pix_rect.x, 
+                                     &pix_rect.y,
+                                     &pix_rect.width,
+                                     &pix_rect.height);
 
   gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
-  x += cell_area->x + xpad;
-  y += cell_area->y + ypad;
+  pix_rect.x += cell_area->x + xpad;
+  pix_rect.y += cell_area->y + ypad;
+  pix_rect.width -= xpad * 2;
+  pix_rect.height -= ypad * 2;
 
   if (!gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect))
     return;
@@ -807,7 +811,8 @@ gtk_cell_renderer_pixbuf_render (GtkCellRenderer      *cell,
       pixbuf = stated;
     }
 
-  gtk_render_icon (context, cr, pixbuf, x, y);
+  gtk_render_icon (context, cr, pixbuf,
+                   pix_rect.x, pix_rect.y);
 
   gtk_style_context_restore (context);
   g_object_unref (pixbuf);



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