static void ensure_pixbuf_for_icon_set (GtkIconHelper *self, GtkStyleContext *context, GtkIconSet *icon_set) { if (!check_invalidate_pixbuf (self, context)) return; G_GNUC_BEGIN_IGNORE_DEPRECATIONS; self->priv->rendered_pixbuf = gtk_icon_set_render_icon_pixbuf (icon_set, context, self->priv->icon_size); G_GNUC_END_IGNORE_DEPRECATIONS; }
static void ensure_pixbuf_at_size (GtkIconHelper *self, GtkStyleContext *context) { gint width, height; GdkPixbuf *stated; if (!check_invalidate_pixbuf (self, context)) return; if (self->priv->rendered_pixbuf) return; if (self->priv->force_scale_pixbuf && (self->priv->pixel_size != -1 || self->priv->icon_size != GTK_ICON_SIZE_INVALID)) { ensure_icon_size (self, context, &width, &height); if (self->priv->orig_pixbuf_scale > 1 || /* These should divide the orig_pixbuf size by scale, but need not due to the above scale > 1 check */ width < gdk_pixbuf_get_width (self->priv->orig_pixbuf) || height < gdk_pixbuf_get_height (self->priv->orig_pixbuf)) { width = MIN (width, gdk_pixbuf_get_width (self->priv->orig_pixbuf) / self->priv->orig_pixbuf_scale); height = MIN (height, gdk_pixbuf_get_height (self->priv->orig_pixbuf) / self->priv->orig_pixbuf_scale); self->priv->rendered_pixbuf = gdk_pixbuf_scale_simple (self->priv->orig_pixbuf, width, height, GDK_INTERP_BILINEAR); } } else if (self->priv->orig_pixbuf_scale > 1) { width = gdk_pixbuf_get_width (self->priv->orig_pixbuf) / self->priv->orig_pixbuf_scale; height =gdk_pixbuf_get_height (self->priv->orig_pixbuf) / self->priv->orig_pixbuf_scale; self->priv->rendered_pixbuf = gdk_pixbuf_scale_simple (self->priv->orig_pixbuf, width, height, GDK_INTERP_BILINEAR); } if (!self->priv->rendered_pixbuf) self->priv->rendered_pixbuf = g_object_ref (self->priv->orig_pixbuf); stated = ensure_stated_pixbuf_from_pixbuf (self, context, self->priv->rendered_pixbuf); g_object_unref (self->priv->rendered_pixbuf); self->priv->rendered_pixbuf = stated; }
static void ensure_pixbuf_for_icon_name_or_gicon (GtkIconHelper *self, GtkStyleContext *context) { GtkIconTheme *icon_theme; gint width, height; GtkIconInfo *info; GtkIconLookupFlags flags; if (!check_invalidate_pixbuf (self, context)) return; icon_theme = gtk_icon_theme_get_default (); flags = get_icon_lookup_flags (self); ensure_icon_size (self, context, &width, &height); if (self->priv->storage_type == GTK_IMAGE_ICON_NAME && self->priv->icon_name != NULL) { info = gtk_icon_theme_lookup_icon (icon_theme, self->priv->icon_name, MIN (width, height), flags); } else if (self->priv->storage_type == GTK_IMAGE_GICON && self->priv->gicon != NULL) { info = gtk_icon_theme_lookup_by_gicon (icon_theme, self->priv->gicon, MIN (width, height), flags); } else { g_assert_not_reached (); return; } self->priv->rendered_pixbuf = ensure_stated_icon_from_info (self, context, info); if (info) g_object_unref (info); }