[gtk+] Revert "image: Optimize non-resize changes"



commit 278fa902e21d79a251cabb833822553feb49d674
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Feb 11 12:01:36 2015 -0500

    Revert "image: Optimize non-resize changes"
    
    This reverts commit 6276b9cda0b179e6a29b9002f82a338dc6f9649f.
    
    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

 gtk/gtkimage.c |  132 ++++++++++----------------------------------------------
 1 files changed, 23 insertions(+), 109 deletions(-)
---
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 449a400..5763f06 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -928,20 +928,14 @@ 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));
 
   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 (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;
     }
@@ -975,16 +971,7 @@ gtk_image_set_from_file   (GtkImage    *image,
   g_object_unref (anim);
 
   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,36 +1044,22 @@ 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)
     {
@@ -1211,16 +1180,7 @@ 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)
     {
@@ -1266,16 +1219,7 @@ 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)
     {
@@ -1321,16 +1259,7 @@ 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)
     {
@@ -1373,16 +1296,7 @@ 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));
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]