[gtk+] iconhelper: Apply icon-effect directly
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] iconhelper: Apply icon-effect directly
- Date: Fri, 4 Dec 2015 16:45:35 +0000 (UTC)
commit 72d4b65b1d93f64b586f14c28503cfdb87e6bf10
Author: Benjamin Otte <otte redhat com>
Date: Fri Dec 4 16:55:02 2015 +0100
iconhelper: Apply icon-effect directly
Instead of creating an icon source, making sure no state is set and
therefore the icon-effect will be applied and then rendering that icon
source, just call the icon-effect apply function.
Also, the new way isn't deprecated.
gtk/gtkiconhelper.c | 28 ++++------------------------
1 files changed, 4 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index acae39c..418b984 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -161,32 +161,12 @@ ensure_stated_surface_from_pixbuf (GtkIconHelper *self,
gint scale,
GdkWindow *window)
{
- GdkPixbuf *rendered;
- GtkIconSource *source;
cairo_surface_t *surface;
+ GtkCssIconEffect icon_effect;
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-
- /* FIXME: use gtk_icon_info_load_icon? */
-
- source = gtk_icon_source_new ();
- gtk_icon_source_set_pixbuf (source, pixbuf);
- /* The size here is arbitrary; since size isn't
- * wildcarded in the source, it isn't supposed to be
- * scaled by the engine function
- */
- gtk_icon_source_set_size (source,
- GTK_ICON_SIZE_SMALL_TOOLBAR);
- gtk_icon_source_set_size_wildcarded (source, FALSE);
-
- rendered = gtk_render_icon_pixbuf (context, source, (GtkIconSize) -1);
- gtk_icon_source_free (source);
-
- G_GNUC_END_IGNORE_DEPRECATIONS;
-
- surface = gdk_cairo_surface_create_from_pixbuf (rendered, scale, window);
-
- g_object_unref (rendered);
+ surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale, window);
+ icon_effect = _gtk_css_icon_effect_value_get (_gtk_style_context_peek_property (context,
GTK_CSS_PROPERTY_ICON_EFFECT));
+ gtk_css_icon_effect_apply (icon_effect, surface);
return surface;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]