gnome-desktop r5465 - trunk/libgnome-desktop



Author: alexl
Date: Thu Apr 16 09:22:03 2009
New Revision: 5465
URL: http://svn.gnome.org/viewvc/gnome-desktop?rev=5465&view=rev

Log:
2009-04-16  Alexander Larsson  <alexl redhat com>

	Bug 141557 â Svg backgrounds not scaled correctly

	* gnome-bg.c:
	(get_as_pixbuf):
	When loading an svg, load at the requested zoom level
	instead of resizing after rendering.



Modified:
   trunk/libgnome-desktop/ChangeLog
   trunk/libgnome-desktop/gnome-bg.c

Modified: trunk/libgnome-desktop/gnome-bg.c
==============================================================================
--- trunk/libgnome-desktop/gnome-bg.c	(original)
+++ trunk/libgnome-desktop/gnome-bg.c	Thu Apr 16 09:22:03 2009
@@ -1518,7 +1518,20 @@
 		return ent->u.pixbuf;
 	}
 	else {
-		GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+		GdkPixbufFormat *format;
+		GdkPixbuf *pixbuf;
+
+		/* If scalable choose maximum size */
+		format = gdk_pixbuf_get_file_info (bg->filename, NULL, NULL);
+		if (format != NULL &&
+		    strcmp (gdk_pixbuf_format_get_name (format), "svg") == 0 &&
+		    (bg->last_pixmap_width > 0 && bg->last_pixmap_height > 0) &&
+		    (bg->placement == GNOME_BG_PLACEMENT_FILL_SCREEN ||
+		     bg->placement == GNOME_BG_PLACEMENT_SCALED ||
+		     bg->placement == GNOME_BG_PLACEMENT_ZOOMED))
+			pixbuf = gdk_pixbuf_new_from_file_at_size (filename, bg->last_pixmap_width, bg->last_pixmap_height, NULL);
+		else
+			pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
 
 		if (pixbuf)
 			file_cache_add_pixbuf (bg, filename, pixbuf);



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