background space usage

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

 



Current solar background's consume 33Mb. This a bit on the heavy side, especially on the Live CD which is over its image limit. Currently there are 4 different images (morning, noon, evening, night) sent out in 4 different sizes (4:3, 16:10, 5:4 and 8:3 for dual screen). What we could do is to send out just one 3200:1200 image and patch up gnome-desktop background handling to support cropping to the right aspect.

So currently we have:
<from>
	<size width="2048" height="1536">4-3.png</size>
	<size width="1920" height="1200">16-10.png</size>
	<size width="1600" height="1280">5-4.png</size>
	<size width="3200" height="1200">8-3.png</size>	
</from>

And since we are interested in the stuff in the bottom right corner we add an X offset:

<from>
	<size width="1600" height="1200" x="1600" y="0">8-3.png</size>
	<size width="1920" height="1200" x="1280" y="0">8-3.png</size>
	<size width="1500" height="1200" x="1700" y="0">8-3.png</size>
	<size width="3200" height="1200"               >8-3.png</size>
</from>

This would allow us to ship just one 3200x1200 size of each time of day image.

I do realise this is very late since the freeze is on Tuesday, so this can easily wait till F11. But if people think it may be possible to repackage gnome-desktop and the backgrounds in time then forward the attached patch to the gnome-desktop packagers and see if they agree.
--- gnome-bg.c.old	2008-10-26 22:28:55.000000000 +0000
+++ gnome-bg.c	2008-10-26 22:40:40.000000000 +0000
@@ -72,6 +72,8 @@
 {
 	gint width;
 	gint height;
+	gint offset_x;
+	gint offset_y;
 
 	char *file;
 };
@@ -1747,16 +1749,15 @@
 static GdkPixbuf *
 get_pixbuf (GnomeBG *bg)
 {
-	/* FIXME: this ref=TRUE/FALSE stuff is crazy */
-	
-	gboolean ref = FALSE;
 	
 	if (!bg->pixbuf_cache && bg->filename) {
-		ref = TRUE;
 		bg->file_mtime = get_mtime (bg->filename);
 		
 		bg->pixbuf_cache = get_as_pixbuf (bg, bg->filename);
-		if (!bg->pixbuf_cache) {
+		if (bg->pixbuf_cache) {
+            g_object_ref (bg->pixbuf_cache);
+        }
+        else {
 			SlideShow *show = get_as_slideshow (bg, bg->filename);
 
 			if (show) {
@@ -1769,21 +1770,32 @@
 
 				if (slide->fixed) {
 					FileSize *size;
+                    GdkPixbuf *pixbuf;
 					size = find_best_size (slide->file1, bg->last_pixmap_width, bg->last_pixmap_height);
-					bg->pixbuf_cache = get_as_pixbuf (bg, size->file);
+					pixbuf = get_as_pixbuf (bg, size->file);
+                    if (pixbuf){
+                        bg->pixbuf_cache = gdk_pixbuf_new_subpixbuf(pixbuf, size->offset_x , size->offset_y, size->width, size->height);
+                    }
+                    
+                    
 				}
 				else {
-					FileSize *size;
+					FileSize *size1, *size2;
 					GdkPixbuf *p1, *p2;
-					size = find_best_size (slide->file1, bg->last_pixmap_width, bg->last_pixmap_height);
-					p1 = get_as_pixbuf (bg, size->file);
-					size = find_best_size (slide->file2, bg->last_pixmap_width, bg->last_pixmap_height);
-					p2 = get_as_pixbuf (bg, size->file);
+					size1 = find_best_size (slide->file1, bg->last_pixmap_width, bg->last_pixmap_height);
+					p1 = get_as_pixbuf (bg, size1->file);
+					size2 = find_best_size (slide->file2, bg->last_pixmap_width, bg->last_pixmap_height);
+					p2 = get_as_pixbuf (bg, size2->file);
 
 
 					if (p1 && p2) {
-						bg->pixbuf_cache = blend (p1, p2, alpha);
-						ref = FALSE;
+                        p1 = gdk_pixbuf_new_subpixbuf(p1, size1->offset_x , size1->offset_y, size1->width, size1->height);
+                        p2 = gdk_pixbuf_new_subpixbuf(p2, size2->offset_x , size2->offset_y, size2->width, size2->height);
+                        if (p1 && p2) {
+						    bg->pixbuf_cache = blend (p1, p2, alpha);
+                        }
+                        if (p1) g_object_unref (p1);
+                        if (p2) g_object_unref (p2);
 					}
 				}
 
@@ -1794,9 +1806,6 @@
 		}
 	}
 
-	if (bg->pixbuf_cache && ref)
-		g_object_ref (bg->pixbuf_cache);
-	
 	return bg->pixbuf_cache;
 }
 
@@ -2107,6 +2116,10 @@
 				size->width = atoi (attr_values[i]);
 			else if (strcmp (attr_names[i], "height") == 0)
 				size->height = atoi (attr_values[i]);
+			else if (strcmp (attr_names[i], "x") == 0)
+				size->offset_x = atoi (attr_values[i]);
+			else if (strcmp (attr_names[i], "y") == 0)
+				size->offset_y = atoi (attr_values[i]);
 		}
 		if (parser->stack->tail &&
 		    (strcmp (parser->stack->tail->data, "file") == 0 ||
@@ -2222,6 +2235,8 @@
 		fs = g_new (FileSize, 1);
 		fs->width = -1;
 		fs->height = -1;
+		fs->offset_x = 0;
+		fs->offset_y = 0;
 		fs->file = g_strdup (text);
 		slide->file1 = g_slist_prepend (slide->file1, fs);
 		if (slide->file1->next != NULL)
@@ -2244,6 +2259,8 @@
 		fs = g_new (FileSize, 1);
 		fs->width = -1;
 		fs->height = -1;
+		fs->offset_x = 0;
+		fs->offset_y = 0;
 		fs->file = g_strdup (text);
 		slide->file2 = g_slist_prepend (slide->file2, fs);
 		if (slide->file2->next != NULL)
@@ -2318,14 +2335,14 @@
 		g_print ("File1:\n");
 		for (slist = slide->file1; slist != NULL; slist = slist->next) {
 			FileSize *size = slist->data;
-			g_print ("\t%s (%dx%d)\n", 
-				 size->file, size->width, size->height);
+			g_print ("\t%s (%dx%d+%d+%d)\n", 
+				 size->file, size->width, size->height, size->offset_x, size->offset_y);
 		}
 		g_print ("File2:\n");
 		for (slist = slide->file2; slist != NULL; slist = slist->next) {
 			FileSize *size = slist->data;
-			g_print ("\t%s (%dx%d)\n", 
-				 size->file, size->width, size->height);
+			g_print ("\t%s (%dx%d+%d+%d)\n", 
+				 size->file, size->width, size->height, size->offset_x, size->offset_y);
 		}
 	}
 #endif
_______________________________________________
Fedora-art-list mailing list
Fedora-art-list@xxxxxxxxxx
http://www.redhat.com/mailman/listinfo/fedora-art-list

[Index of Archives]     [Fedora Music]     [Fedora Development]     [Linux Kernel]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Directory]     [PAM]     [Big List of Linux Books]     [Gimp]     [Yosemite News]

  Powered by Linux