summaryrefslogtreecommitdiff
path: root/gtk/gtkcellrendererpixbuf.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2011-06-09 22:56:56 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2011-06-09 22:59:06 -0400
commit35fdce68e155765a131039c1a745c6b26d663338 (patch)
treecfa219e73df81647e1d827dc1a0cdc9a98cd22c9 /gtk/gtkcellrendererpixbuf.c
parenta081485269a94ddccbcb6ebeb9c79a94dc2ac253 (diff)
downloadgtk+-35fdce68e155765a131039c1a745c6b26d663338.tar.gz
cellrendererpix: make the icon render properly again
pix_rect was not initialized anymore, so the gdk_rectangle_intersect() call would always fail.
Diffstat (limited to 'gtk/gtkcellrendererpixbuf.c')
-rw-r--r--gtk/gtkcellrendererpixbuf.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c
index 83e9352957..73c36eb376 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);