Revert "image: Optimize non-resize changes"

This reverts commit 6276b9cda0.

This change was causing problems in gnome-mines. Revert it
until we can figure out what exactly is going wrong there.
See https://bugzilla.redhat.com/show_bug.cgi?id=1190887
This commit is contained in:
Matthias Clasen 2015-02-11 12:01:36 -05:00
parent 879956e2f5
commit 278fa902e2

View File

@ -928,9 +928,6 @@ gtk_image_set_from_file (GtkImage *image,
GtkImagePrivate *priv;
GdkPixbufAnimation *anim;
gint scale_factor;
gint old_width, old_height;
gint new_width, new_height;
GtkStyleContext *context;
g_return_if_fail (GTK_IS_IMAGE (image));
@ -938,10 +935,7 @@ gtk_image_set_from_file (GtkImage *image,
g_object_freeze_notify (G_OBJECT (image));
context = gtk_widget_get_style_context (GTK_WIDGET (image));
_gtk_icon_helper_get_size (priv->icon_helper, context, &old_width, &old_height);
gtk_image_reset (image);
gtk_image_clear (image);
if (filename == NULL)
{
@ -954,7 +948,9 @@ gtk_image_set_from_file (GtkImage *image,
if (anim == NULL)
{
gtk_image_set_from_icon_name (image, "image-missing", DEFAULT_ICON_SIZE);
gtk_image_set_from_icon_name (image,
"image-missing",
DEFAULT_ICON_SIZE);
g_object_thaw_notify (G_OBJECT (image));
return;
}
@ -976,15 +972,6 @@ gtk_image_set_from_file (GtkImage *image,
priv->filename = g_strdup (filename);
_gtk_icon_helper_get_size (priv->icon_helper, context, &new_width, &new_height);
if (gtk_widget_get_visible (GTK_WIDGET (image)))
{
if (old_width != new_width || old_height != new_height)
gtk_widget_queue_resize (GTK_WIDGET (image));
else
gtk_widget_queue_draw (GTK_WIDGET (image));
}
g_object_thaw_notify (G_OBJECT (image));
}
@ -1021,7 +1008,9 @@ gtk_image_set_from_resource (GtkImage *image,
if (animation == NULL)
{
gtk_image_set_from_icon_name (image, "image-missing", DEFAULT_ICON_SIZE);
gtk_image_set_from_icon_name (image,
"image-missing",
DEFAULT_ICON_SIZE);
g_object_thaw_notify (G_OBJECT (image));
return;
}
@ -1055,34 +1044,20 @@ gtk_image_set_from_pixbuf (GtkImage *image,
GdkPixbuf *pixbuf)
{
GtkImagePrivate *priv;
gint old_width, old_height;
gint new_width, new_height;
GtkStyleContext *context;
g_return_if_fail (GTK_IS_IMAGE (image));
g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf));
g_return_if_fail (pixbuf == NULL ||
GDK_IS_PIXBUF (pixbuf));
priv = image->priv;
g_object_freeze_notify (G_OBJECT (image));
context = gtk_widget_get_style_context (GTK_WIDGET (image));
_gtk_icon_helper_get_size (priv->icon_helper, context, &old_width, &old_height);
gtk_image_reset (image);
gtk_image_clear (image);
if (pixbuf != NULL)
_gtk_icon_helper_set_pixbuf (priv->icon_helper, pixbuf);
_gtk_icon_helper_get_size (priv->icon_helper, context, &new_width, &new_height);
if (gtk_widget_get_visible (GTK_WIDGET (image)))
{
if (old_width != new_width || old_height != new_height)
gtk_widget_queue_resize (GTK_WIDGET (image));
else
gtk_widget_queue_draw (GTK_WIDGET (image));
}
g_object_notify (G_OBJECT (image), "pixbuf");
g_object_thaw_notify (G_OBJECT (image));
@ -1184,9 +1159,6 @@ gtk_image_set_from_animation (GtkImage *image,
GdkPixbufAnimation *animation)
{
GtkImagePrivate *priv;
gint old_width, old_height;
gint new_width, new_height;
GtkStyleContext *context;
g_return_if_fail (GTK_IS_IMAGE (image));
g_return_if_fail (animation == NULL ||
@ -1199,10 +1171,7 @@ gtk_image_set_from_animation (GtkImage *image,
if (animation)
g_object_ref (animation);
context = gtk_widget_get_style_context (GTK_WIDGET (image));
_gtk_icon_helper_get_size (priv->icon_helper, context, &old_width, &old_height);
gtk_image_reset (image);
gtk_image_clear (image);
if (animation != NULL)
{
@ -1212,15 +1181,6 @@ gtk_image_set_from_animation (GtkImage *image,
g_object_notify (G_OBJECT (image), "pixbuf-animation");
_gtk_icon_helper_get_size (priv->icon_helper, context, &new_width, &new_height);
if (gtk_widget_get_visible (GTK_WIDGET (image)))
{
if (old_width != new_width || old_height != new_height)
gtk_widget_queue_resize (GTK_WIDGET (image));
else
gtk_widget_queue_draw (GTK_WIDGET (image));
}
g_object_thaw_notify (G_OBJECT (image));
}
@ -1241,9 +1201,6 @@ gtk_image_set_from_icon_name (GtkImage *image,
{
GtkImagePrivate *priv;
gchar *new_name;
gint old_width, old_height;
gint new_width, new_height;
GtkStyleContext *context;
g_return_if_fail (GTK_IS_IMAGE (image));
@ -1252,11 +1209,7 @@ gtk_image_set_from_icon_name (GtkImage *image,
g_object_freeze_notify (G_OBJECT (image));
new_name = g_strdup (icon_name);
context = gtk_widget_get_style_context (GTK_WIDGET (image));
_gtk_icon_helper_get_size (priv->icon_helper, context, &old_width, &old_height);
gtk_image_reset (image);
gtk_image_clear (image);
if (new_name)
{
@ -1267,15 +1220,6 @@ gtk_image_set_from_icon_name (GtkImage *image,
g_object_notify (G_OBJECT (image), "icon-name");
g_object_notify (G_OBJECT (image), "icon-size");
_gtk_icon_helper_get_size (priv->icon_helper, context, &new_width, &new_height);
if (gtk_widget_get_visible (GTK_WIDGET (image)))
{
if (old_width != new_width || old_height != new_height)
gtk_widget_queue_resize (GTK_WIDGET (image));
else
gtk_widget_queue_draw (GTK_WIDGET (image));
}
g_object_thaw_notify (G_OBJECT (image));
}
@ -1295,9 +1239,6 @@ gtk_image_set_from_gicon (GtkImage *image,
GtkIconSize size)
{
GtkImagePrivate *priv;
gint old_width, old_height;
gint new_width, new_height;
GtkStyleContext *context;
g_return_if_fail (GTK_IS_IMAGE (image));
@ -1308,10 +1249,7 @@ gtk_image_set_from_gicon (GtkImage *image,
if (icon)
g_object_ref (icon);
context = gtk_widget_get_style_context (GTK_WIDGET (image));
_gtk_icon_helper_get_size (priv->icon_helper, context, &old_width, &old_height);
gtk_image_reset (image);
gtk_image_clear (image);
if (icon)
{
@ -1322,15 +1260,6 @@ gtk_image_set_from_gicon (GtkImage *image,
g_object_notify (G_OBJECT (image), "gicon");
g_object_notify (G_OBJECT (image), "icon-size");
_gtk_icon_helper_get_size (priv->icon_helper, context, &new_width, &new_height);
if (gtk_widget_get_visible (GTK_WIDGET (image)))
{
if (old_width != new_width || old_height != new_height)
gtk_widget_queue_resize (GTK_WIDGET (image));
else
gtk_widget_queue_draw (GTK_WIDGET (image));
}
g_object_thaw_notify (G_OBJECT (image));
}
@ -1348,9 +1277,6 @@ gtk_image_set_from_surface (GtkImage *image,
cairo_surface_t *surface)
{
GtkImagePrivate *priv;
gint old_width, old_height;
gint new_width, new_height;
GtkStyleContext *context;
g_return_if_fail (GTK_IS_IMAGE (image));
@ -1361,10 +1287,7 @@ gtk_image_set_from_surface (GtkImage *image,
if (surface)
cairo_surface_reference (surface);
context = gtk_widget_get_style_context (GTK_WIDGET (image));
_gtk_icon_helper_get_size (priv->icon_helper, context, &old_width, &old_height);
gtk_image_reset (image);
gtk_image_clear (image);
if (surface)
{
@ -1374,15 +1297,6 @@ gtk_image_set_from_surface (GtkImage *image,
g_object_notify (G_OBJECT (image), "surface");
_gtk_icon_helper_get_size (priv->icon_helper, context, &new_width, &new_height);
if (gtk_widget_get_visible (GTK_WIDGET (image)))
{
if (old_width != new_width || old_height != new_height)
gtk_widget_queue_resize (GTK_WIDGET (image));
else
gtk_widget_queue_draw (GTK_WIDGET (image));
}
g_object_thaw_notify (G_OBJECT (image));
}