[gtk+] iconhelper: Move invalidation check
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] iconhelper: Move invalidation check
- Date: Tue, 1 Dec 2015 23:30:40 +0000 (UTC)
commit c601a9653aae600596f4241bab84b469dfbc2bca
Author: Benjamin Otte <otte redhat com>
Date: Sun Nov 29 01:36:10 2015 +0100
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.
gtk/gtkiconhelper.c | 22 +++-------------------
1 files changed, 3 insertions(+), 19 deletions(-)
---
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 89488c3..4f222ad 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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]