diff options
author | Benjamin Otte <otte@redhat.com> | 2015-01-27 04:48:35 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2015-01-27 05:04:34 +0100 |
commit | 488ea44a597063ecd9d1354bc01b1e165670a98d (patch) | |
tree | 719440be55386ad9a1a2c434c2b2ef094322b54b /gtk/gtkimage.c | |
parent | c42e54e9494d7d56634bd9bbafe38ddf6ee8daa8 (diff) | |
download | gtk+-488ea44a597063ecd9d1354bc01b1e165670a98d.tar.gz |
image: Use _gtk_css_style_property_get_mask_affecting()
... to avoid recomputing the cached surface all the time.
Diffstat (limited to 'gtk/gtkimage.c')
-rw-r--r-- | gtk/gtkimage.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 743cb8caae..5763f06915 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -29,6 +29,7 @@ #include <cairo-gobject.h> #include "gtkcontainer.h" +#include "gtkcssstylepropertyprivate.h" #include "gtkiconhelperprivate.h" #include "gtkimageprivate.h" #include "deprecated/gtkiconfactory.h" @@ -1873,12 +1874,19 @@ icon_theme_changed (GtkImage *image) static void gtk_image_style_updated (GtkWidget *widget) { + static GtkBitmask *affects_icon = NULL; GtkImage *image = GTK_IMAGE (widget); GtkImagePrivate *priv = image->priv; + const GtkBitmask *changes; GTK_WIDGET_CLASS (gtk_image_parent_class)->style_updated (widget); - icon_theme_changed (image); + if (G_UNLIKELY (affects_icon == NULL)) + affects_icon = _gtk_css_style_property_get_mask_affecting (GTK_CSS_AFFECTS_ICON); + + changes = _gtk_style_context_get_changes (gtk_widget_get_style_context (widget)); + if (changes == NULL || _gtk_bitmask_intersects (changes, affects_icon)) + icon_theme_changed (image); priv->baseline_align = 0.0; } |