summaryrefslogtreecommitdiff
path: root/gtk/gtkiconhelper.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-11-29 01:36:10 +0100
committerBenjamin Otte <otte@redhat.com>2015-12-02 00:29:29 +0100
commitc601a9653aae600596f4241bab84b469dfbc2bca (patch)
treeb3cff623b6da927796c22fe6d56d34cd296aefb6 /gtk/gtkiconhelper.c
parentafd0e284375baa0da4a86c31fd1994a3612e1a24 (diff)
downloadgtk+-c601a9653aae600596f4241bab84b469dfbc2bca.tar.gz
iconhelper: Move invalidation check
Just do the invalidation check once, there's no need to do it in every branch of the switch. Also remove useless checks: These functions will not be called if we already have a rendered surface.
Diffstat (limited to 'gtk/gtkiconhelper.c')
-rw-r--r--gtk/gtkiconhelper.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 89488c3d63..4f222ad77b 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -308,9 +308,6 @@ ensure_pixbuf_for_gicon (GtkIconHelper *self,
GtkIconInfo *info;
GtkIconLookupFlags flags;
- if (!check_invalidate_pixbuf (self, context))
- return;
-
icon_theme = gtk_icon_theme_get_for_screen (gtk_style_context_get_screen (context));
flags = get_icon_lookup_flags (self, context);
@@ -331,9 +328,6 @@ 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);
@@ -377,13 +371,6 @@ ensure_pixbuf_from_surface (GtkIconHelper *self,
gint width, height;
cairo_t *cr;
-
- if (!check_invalidate_pixbuf (self, context))
- return;
-
- if (self->priv->rendered_pixbuf)
- return;
-
get_surface_size (self, orig_surface, &width, &height);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
@@ -409,12 +396,6 @@ ensure_pixbuf_at_size (GtkIconHelper *self,
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))
@@ -461,6 +442,9 @@ _gtk_icon_helper_ensure_pixbuf (GtkIconHelper *self,
GtkIconSet *icon_set;
GIcon *gicon;
+ if (!check_invalidate_pixbuf (self, context))
+ return g_object_ref (self->priv->rendered_pixbuf);
+
switch (gtk_image_definition_get_storage_type (self->priv->def))
{
case GTK_IMAGE_SURFACE: