]> Pileus Git - ~andy/gtk/commitdiff
cellrendererpix: make the icon render properly again
authorCosimo Cecchi <cosimoc@gnome.org>
Fri, 10 Jun 2011 02:56:56 +0000 (22:56 -0400)
committerCosimo Cecchi <cosimoc@gnome.org>
Fri, 10 Jun 2011 02:59:06 +0000 (22:59 -0400)
pix_rect was not initialized anymore, so the gdk_rectangle_intersect()
call would always fail.

gtk/gtkcellrendererpixbuf.c

index 83e935295784f0acaf73a54ba0c5473e21931b58..73c36eb376b97ae1d8a88b912af1a59457f93a29 100644 (file)
@@ -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);