f-spot r4089 - in trunk: . src
- From: rubenv svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4089 - in trunk: . src
- Date: Tue, 24 Jun 2008 18:47:32 +0000 (UTC)
Author: rubenv
Date: Tue Jun 24 18:47:32 2008
New Revision: 4089
URL: http://svn.gnome.org/viewvc/f-spot?rev=4089&view=rev
Log:
2008-06-24 Ruben Vermeersch <ruben savanne be>
* src/ColorAdjustment.cs: Clean up ColorAdjustment a little, document what
appears to be a clever optimization.
* src/PhotoView.cs: Change to match naming.
Modified:
trunk/ChangeLog
trunk/src/ColorAdjustment.cs
trunk/src/PhotoView.cs
Modified: trunk/src/ColorAdjustment.cs
==============================================================================
--- trunk/src/ColorAdjustment.cs (original)
+++ trunk/src/ColorAdjustment.cs Tue Jun 24 18:47:32 2008
@@ -24,8 +24,23 @@
protected int nsteps = 20;
protected Cms.Intent intent = Cms.Intent.Perceptual;
- public Gdk.Pixbuf Pixbuf {
- get { return image; }
+ // This is the input pixbuf, on which the adjustment will be performed.
+ //
+ // If it is not assigned, it will be loaded from the photo given when
+ // constructing the ColorAdjustment. However, assigning it (if you
+ // already have a copy in memory) avoids doing a duplicate load.
+ public Gdk.Pixbuf Image {
+ get {
+ if (image == null) {
+ using (ImageFile img = ImageFile.Create (photo.DefaultVersionUri)) {
+ image = img.Load ();
+
+ if (image_profile == null)
+ image_profile = img.GetProfile ();
+ }
+ }
+ return image;
+ }
set { image = value; }
}
@@ -44,13 +59,6 @@
public void Adjust ()
{
bool create_version = photo.DefaultVersion.IsProtected;
- using (ImageFile img = ImageFile.Create (photo.DefaultVersionUri)) {
- if (image == null)
- image = img.Load ();
-
- if (image_profile == null)
- image_profile = img.GetProfile ();
- }
if (image_profile == null)
image_profile = Cms.Profile.CreateStandardRgb ();
@@ -60,33 +68,33 @@
Gdk.Pixbuf final = new Gdk.Pixbuf (Gdk.Colorspace.Rgb,
false, 8,
- image.Width,
- image.Height);
+ Image.Width,
+ Image.Height);
profiles = new List <Cms.Profile> (4);
profiles.Add (image_profile);
GenerateAdjustments ();
profiles.Add (destination_profile);
Cms.Profile [] list = profiles.ToArray ();
- if (image.HasAlpha) {
- Pixbuf alpha = PixbufUtils.Flatten (image);
+ if (Image.HasAlpha) {
+ Pixbuf alpha = PixbufUtils.Flatten (Image);
Transform transform = new Transform (list,
PixbufUtils.PixbufCmsFormat (alpha),
PixbufUtils.PixbufCmsFormat (final),
intent, 0x0000);
PixbufUtils.ColorAdjust (alpha, final, transform);
- PixbufUtils.ReplaceColor (final, image);
+ PixbufUtils.ReplaceColor (final, Image);
alpha.Dispose ();
final.Dispose ();
- final = image;
+ final = Image;
} else {
Cms.Transform transform = new Cms.Transform (list,
- PixbufUtils.PixbufCmsFormat (image),
+ PixbufUtils.PixbufCmsFormat (Image),
PixbufUtils.PixbufCmsFormat (final),
intent, 0x0000);
- PixbufUtils.ColorAdjust (image, final, transform);
- image.Dispose ();
+ PixbufUtils.ColorAdjust (Image, final, transform);
+ Image.Dispose ();
}
photo.SaveVersion (final, create_version);
Modified: trunk/src/PhotoView.cs
==============================================================================
--- trunk/src/PhotoView.cs (original)
+++ trunk/src/PhotoView.cs Tue Jun 24 18:47:32 2008
@@ -278,7 +278,7 @@
try {
FSpot.SepiaTone sepia = new FSpot.SepiaTone ((Photo)View.Item.Current);
- sepia.Pixbuf = View.CompletePixbuf ();
+ sepia.Image = View.CompletePixbuf ();
sepia.Adjust ();
pq.Commit (Item.Index);
} catch (System.Exception e) {
@@ -295,7 +295,7 @@
try {
FSpot.Desaturate desaturate = new FSpot.Desaturate ((Photo) View.Item.Current);
- desaturate.Pixbuf = View.CompletePixbuf ();
+ desaturate.Image = View.CompletePixbuf ();
desaturate.Adjust ();
pq.Commit (Item.Index);
} catch (System.Exception e) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]