summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-10-18 14:02:27 +0200
committerJasmine Hassan <[email protected]>2012-11-14 09:42:33 +0200
commit3731b35d212b5efed3835efe7e50be55970dfe8e (patch)
tree45013dcb3bf58ebbc149103f64c42a0ab4d8c19a /libcaja-private
parent299c8466cdf47ae0468a216c2392b719330a1971 (diff)
downloadcaja-3731b35d212b5efed3835efe7e50be55970dfe8e.tar.bz2
caja-3731b35d212b5efed3835efe7e50be55970dfe8e.tar.xz
[lc-p] port CajaCellRendererPixbufEmblem to cairo drawing
http://git.gnome.org/browse/nautilus/commit/?id=dfbf8b9b5636dceb3d6291c980d2c349afc849d7
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-cell-renderer-pixbuf-emblem.c49
1 files changed, 16 insertions, 33 deletions
diff --git a/libcaja-private/caja-cell-renderer-pixbuf-emblem.c b/libcaja-private/caja-cell-renderer-pixbuf-emblem.c
index 4fec3a4a..63cbf3db 100644
--- a/libcaja-private/caja-cell-renderer-pixbuf-emblem.c
+++ b/libcaja-private/caja-cell-renderer-pixbuf-emblem.c
@@ -428,10 +428,10 @@ caja_cell_renderer_pixbuf_emblem_render (GtkCellRenderer *cell,
GdkPixbuf *pixbuf;
GdkRectangle pix_rect;
GdkRectangle pix_emblem_rect;
- GdkRectangle draw_rect;
gboolean stock_pixbuf = FALSE;
gint xpad, ypad;
gboolean is_expander, is_expanded;
+ cairo_t *cr;
pixbuf = cellpixbuf->pixbuf;
g_object_get (cell,
@@ -476,22 +476,15 @@ caja_cell_renderer_pixbuf_emblem_render (GtkCellRenderer *cell,
pix_rect.width -= xpad * 2;
pix_rect.height -= ypad * 2;
- if (gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect) &&
- gdk_rectangle_intersect (expose_area, &draw_rect, &draw_rect))
- {
- gdk_draw_pixbuf (window,
- gtk_widget_get_style (widget)->black_gc,
- pixbuf,
- /* pixbuf 0, 0 is at pix_rect.x, pix_rect.y */
- draw_rect.x - pix_rect.x,
- draw_rect.y - pix_rect.y,
- draw_rect.x,
- draw_rect.y,
- draw_rect.width,
- draw_rect.height,
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
- }
+ cr = gdk_cairo_create (window);
+ gdk_cairo_rectangle (cr, expose_area);
+ cairo_clip (cr);
+ gdk_cairo_rectangle (cr, cell_area);
+ cairo_clip (cr);
+
+ gdk_cairo_set_source_pixbuf (cr, pixbuf, pix_rect.x, pix_rect.y);
+ gdk_cairo_rectangle (cr, &pix_rect);
+ cairo_fill (cr);
if (cellpixbuf->pixbuf_emblem)
{
@@ -499,21 +492,11 @@ caja_cell_renderer_pixbuf_emblem_render (GtkCellRenderer *cell,
pix_emblem_rect.height = gdk_pixbuf_get_height (cellpixbuf->pixbuf_emblem);
pix_emblem_rect.x = pix_rect.x;
pix_emblem_rect.y = pix_rect.y + pix_rect.height - pix_emblem_rect.height;
- if (gdk_rectangle_intersect (cell_area, &pix_emblem_rect, &draw_rect) &&
- gdk_rectangle_intersect (expose_area, &draw_rect, &draw_rect))
- {
- gdk_draw_pixbuf (window,
- gtk_widget_get_style (widget)->black_gc,
- cellpixbuf->pixbuf_emblem,
- /* pixbuf 0, 0 is at pix_emblem_rect.x, pix_emblem_rect.y */
- draw_rect.x - pix_emblem_rect.x,
- draw_rect.y - pix_emblem_rect.y,
- draw_rect.x,
- draw_rect.y,
- draw_rect.width,
- draw_rect.height,
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
- }
+ gdk_cairo_set_source_pixbuf (cr, cellpixbuf->pixbuf_emblem,
+ pix_emblem_rect.x, pix_emblem_rect.y);
+ gdk_cairo_rectangle (cr, &pix_emblem_rect);
+ cairo_fill (cr);
}
+
+ cairo_destory (cr);
}