[gnome-desktop] gnome-bg: Don't keep duplicates of cache width and height



commit c5e5db705ee982e3cc0761a7c83235798d8428bd
Author: Benjamin Otte <otte redhat com>
Date:   Wed Sep 29 18:07:17 2010 +0200

    gnome-bg: Don't keep duplicates of cache width and height

 libgnome-desktop/gnome-bg.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
index 4507e8f..7629ef3 100644
--- a/libgnome-desktop/gnome-bg.c
+++ b/libgnome-desktop/gnome-bg.c
@@ -100,9 +100,6 @@ struct _GnomeBG
 	GdkColor		primary;
 	GdkColor		secondary;
 
- 	gint                    last_pixmap_width;
- 	gint                    last_pixmap_height;
-
 	GFileMonitor *		file_monitor;
 
 	guint                   changed_id;
@@ -985,15 +982,12 @@ gnome_bg_create_surface (GnomeBG	    *bg,
 	g_return_val_if_fail (bg != NULL, NULL);
 	g_return_val_if_fail (window != NULL, NULL);
 
-	if (bg->last_pixmap_width != width ||
-	    bg->last_pixmap_height != height)  {
-		if (bg->pixbuf_cache) {
-			g_object_unref (bg->pixbuf_cache);
-			bg->pixbuf_cache = NULL;
-		}
-	}
-	bg->last_pixmap_width = width;
-	bg->last_pixmap_height = height;
+        if (bg->pixbuf_cache &&
+            gdk_pixbuf_get_width (bg->pixbuf_cache) != width &&
+            gdk_pixbuf_get_height (bg->pixbuf_cache) != height) {
+                g_object_unref (bg->pixbuf_cache);
+                bg->pixbuf_cache = NULL;
+        }
 
 	/* has the side effect of loading and caching pixbuf only when in tile mode */
 	gnome_bg_get_pixmap_size (bg, width, height, &pm_width, &pm_height);



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