Patch for full resolution icons.



The attached patch changes the way the EditIcon builds its icon. As it
stands it reads it as a clip from a scaled image. With this patch a copy
of the unscaled image is kept in memory and that is used as the source
of the icon. Having to know how to do the scaling feels a little icky,
perhaps it should be returned by the PxbufUtils.LoadAtMaxSize method.

cheers

Loz Hygate
? Makefile.solution.f-spot
? configure.scan
? f-spot.cmbx
? f-spot.mdsx
? make.sh
? po/Makefile
? po/Makefile.in
? po/Makefile.in.in
? po/POTFILES
? po/es.gmo
? src/AssemblyInfo.cs
? src/Main.cs
? src/Makefile.f-spot
? src/MyProgram.cs
? src/f-spot.pidb
? src/f-spot.prjx
Index: src/TagCommands.cs
===================================================================
RCS file: /cvs/gnome/f-spot/src/TagCommands.cs,v
retrieving revision 1.8
diff -u -r1.8 TagCommands.cs
--- src/TagCommands.cs	12 Sep 2004 19:26:38 -0000	1.8
+++ src/TagCommands.cs	16 Oct 2004 19:03:58 -0000
@@ -369,6 +369,8 @@
 		SpinButton photo_spin_button;
 
 		int current_item = -1;
+		Gdk.Pixbuf current_unscaled_image = null;
+		double scale = 0.0;
 		public int CurrentItem {
 			get {
 				return current_item;
@@ -388,6 +390,10 @@
 
 					if (old != null)
 						old.Dispose ();
+						
+					if (current_unscaled_image != null)
+						current_unscaled_image.Dispose ();
+						current_unscaled_image = null;
 				}
 			}
 		}
@@ -404,14 +410,18 @@
 		{
 			int x, y, width, height;
 			Gdk.Pixbuf tmp = null;
-		       
+		    if (current_unscaled_image == null) {
+		    	current_unscaled_image = new Gdk.Pixbuf(photos [current_item].DefaultVersionPath);
+		    	scale = Math.Max (current_unscaled_image.Width / (double)image_view.Parent.Allocation.Width,
+						  current_unscaled_image.Height / (double)image_view.Parent.Allocation.Height);
+		    }
 			image_view.GetSelection (out x, out y, out width, out height);
 
 			if (width > 0 && height > 0) {
-				tmp = new Gdk.Pixbuf (image_view.Pixbuf, x, y, width, height);
+
+				tmp = new Gdk.Pixbuf (current_unscaled_image, (int)(x * scale), (int)(y * scale), (int)(width * scale), (int)(height * scale));
 				
 				preview_image.Pixbuf = PixbufUtils.TagIconFromPixbuf (tmp);
-				
 				tmp.Dispose ();
 			}
 		}
@@ -467,7 +477,9 @@
 					Console.WriteLine ("error {0}", ex);
 				}
 			}
-			
+			// Does this happen automatically because of the Destroy call?
+			if (current_unscaled_image != null)
+				current_unscaled_image.Dispose ();
 			edit_icon_dialog.Destroy ();
 			return success;
 		}


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