Updating branch refs/heads/master to daa0506d3abb84c0e068accc55cb6f139ef2824b (commit) from 0b54a67b2c4b48666755df00313aec9e2b0f45bf (commit)
commit daa0506d3abb84c0e068accc55cb6f139ef2824b Author: Nick Schermer <n...@xfce.org> Date: Sun Oct 14 13:08:29 2012 +0200 Draw translucent icons with cairo. Simpler and saves some pixbuf duplication. thunar/thunar-icon-renderer.c | 17 +++++++++-------- thunar/thunar-shortcuts-icon-renderer.c | 13 ++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/thunar/thunar-icon-renderer.c b/thunar/thunar-icon-renderer.c index 3cb824d..a63a99b 100644 --- a/thunar/thunar-icon-renderer.c +++ b/thunar/thunar-icon-renderer.c @@ -334,6 +334,7 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer, gint max_emblems; gint position; cairo_t *cr; + gdouble alpha; if (G_UNLIKELY (icon_renderer->file == NULL)) return; @@ -390,16 +391,16 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer, if (thunar_clipboard_manager_has_cutted_file (clipboard, icon_renderer->file)) { /* 50% translucent for cutted files */ - temp = exo_gdk_pixbuf_lucent (icon, 50); - g_object_unref (G_OBJECT (icon)); - icon = temp; + alpha = 0.50; } else if (thunar_file_is_hidden (icon_renderer->file)) { /* 75% translucent for hidden files */ - temp = exo_gdk_pixbuf_lucent (icon, 75); - g_object_unref (G_OBJECT (icon)); - icon = temp; + alpha = 0.75; + } + else + { + alpha = 1.00; } g_object_unref (G_OBJECT (clipboard)); @@ -444,7 +445,7 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer, /* render the invalid parts of the icon */ gdk_cairo_set_source_pixbuf (cr, icon, icon_area.x, icon_area.y); gdk_cairo_rectangle (cr, &draw_area); - cairo_fill (cr); + cairo_paint_with_alpha (cr, alpha); } /* release the file's icon */ @@ -526,7 +527,7 @@ thunar_icon_renderer_render (GtkCellRenderer *renderer, /* render the invalid parts of the icon */ gdk_cairo_set_source_pixbuf (cr, emblem, emblem_area.x, emblem_area.y); gdk_cairo_rectangle (cr, &draw_area); - cairo_fill (cr); + cairo_paint (cr); } /* release the emblem */ diff --git a/thunar/thunar-shortcuts-icon-renderer.c b/thunar/thunar-shortcuts-icon-renderer.c index 49e4760..9b2f16d 100644 --- a/thunar/thunar-shortcuts-icon-renderer.c +++ b/thunar/thunar-shortcuts-icon-renderer.c @@ -221,6 +221,7 @@ thunar_shortcuts_icon_renderer_render (GtkCellRenderer *renderer, GdkPixbuf *temp; GIcon *gicon; cairo_t *cr; + gdouble alpha; /* check if we have a volume set */ if (G_UNLIKELY (shortcuts_icon_renderer->gicon != NULL @@ -266,14 +267,12 @@ thunar_shortcuts_icon_renderer_render (GtkCellRenderer *renderer, icon_area.height = gdk_pixbuf_get_height (icon); } + /* 50% translucent for unmounted volumes */ if (shortcuts_icon_renderer->device != NULL && !thunar_device_is_mounted (shortcuts_icon_renderer->device)) - { - /* 50% translucent for unmounted volumes */ - temp = exo_gdk_pixbuf_lucent (icon, 50); - g_object_unref (G_OBJECT (icon)); - icon = temp; - } + alpha = 0.50; + else + alpha = 1.00; icon_area.x = cell_area->x + (cell_area->width - icon_area.width) / 2; icon_area.y = cell_area->y + (cell_area->height - icon_area.height) / 2; @@ -285,7 +284,7 @@ thunar_shortcuts_icon_renderer_render (GtkCellRenderer *renderer, cr = gdk_cairo_create (window); gdk_cairo_set_source_pixbuf (cr, icon, icon_area.x, icon_area.y); gdk_cairo_rectangle (cr, &draw_area); - cairo_fill (cr); + cairo_paint_with_alpha (cr, alpha); cairo_destroy (cr); } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits