Update of /cvsroot/ufraw/ufraw
In directory vz-cvs-3.sog:/tmp/cvs-serv1663

Modified Files:
        ufraw_lensfun.cc 
Log Message:
Update the lens crop factor, fixing bug #3161607.
Add a "Generic, Crop factor %f" lens model to get consistent behaviour.


Index: ufraw_lensfun.cc
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_lensfun.cc,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- ufraw_lensfun.cc    27 Jul 2011 13:50:46 -0000      1.22
+++ ufraw_lensfun.cc    29 Jul 2011 05:49:44 -0000      1.23
@@ -130,6 +130,18 @@
         parse_maker_model(StringValue(), make, sizeof(make),
                           model, sizeof(model));
         Lensfun &Lensfun = Lensfun::Parent(*this);
+        if (strcmp(make, "Generic") == 0) {
+            double crop_factor;
+            int count = sscanf(model, "Crop factor %lf", &crop_factor);
+            if (count == 1) {
+                lfLens cropLens;
+                cropLens.SetMaker(make);
+                cropLens.SetModel(model);
+                cropLens.CropFactor = crop_factor;
+                Lensfun.SetInterpolation(cropLens);
+                return UFObject::Event(type);
+            }
+        }
         const lfLens **lensList = Lensfun.LensDB()->FindLenses(&Lensfun.Camera,
                                   make, model, LF_SEARCH_LOOSE);
         if (lensList == NULL) {
@@ -308,7 +320,14 @@
         if (!HasParent())
             return;
         Lensfun &Lensfun = Lensfun::Parent(*this);
-        Lensfun[ufLensModel].Reset();
+        if (Lensfun.Transformation.CropFactor == 1.0) {
+            Lensfun[ufLensModel].Reset();
+        } else {
+            char *lens_model = g_strdup_printf("Generic, Crop factor %.4g",
+                    Lensfun.Transformation.CropFactor);
+            Lensfun[ufLensModel].Set(lens_model);
+            g_free(lens_model);
+        }
         // While loading rc/cmd/conf data, do not reset the auto setting
         if (ufraw_image_get_data(this) != NULL)
             Lensfun.UFObject::Parent()[ufLensfunAuto].Set("no");
@@ -613,6 +632,7 @@
 void Lensfun::SetInterpolation(const lfLens &lens)
 {
     Interpolation = lens;
+    Transformation.CropFactor = lens.CropFactor;
     static_cast<UFRaw::FocalLength &>((*this)[ufFocalLength]).CreatePresets();
     static_cast<UFRaw::Aperture &>((*this)[ufAperture]).CreatePresets();
     static_cast<UFRaw::Distance &>((*this)[ufDistance]).CreatePresets();


------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
ufraw-cvs mailing list
ufraw-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs

Reply via email to