Author: akv
Date: 2010-06-22 01:38:53 +0200 (Tue, 22 Jun 2010)
New Revision: 3436

Modified:
   trunk/plugins/lensfun/lensfun.c
Log:
Enabled runtime check for lensfun version.

Modified: trunk/plugins/lensfun/lensfun.c
===================================================================
--- trunk/plugins/lensfun/lensfun.c     2010-06-19 22:22:39 UTC (rev 3435)
+++ trunk/plugins/lensfun/lensfun.c     2010-06-21 23:38:53 UTC (rev 3436)
@@ -26,6 +26,11 @@
 #endif /* __SSE2__ */
 #include <rs-lens.h>
 
+/* Set LF_VERSION for old versions of Lensfun - introduced in 0.2.5.1 */
+#ifndef LF_VERSION
+#define LF_VERSION 0
+#endif
+
 #define RS_TYPE_LENSFUN (rs_lensfun_type)
 #define RS_LENSFUN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RS_TYPE_LENSFUN, 
RSLensfun))
 #define RS_LENSFUN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), 
RS_TYPE_LENSFUN, RSLensfunClass))
@@ -492,12 +497,18 @@
                {
                        lfLensCalibTCA tca;
                        tca.Model = LF_TCA_MODEL_LINEAR;
-                       /* Lensfun < 0.2.5 */
-                       tca.Terms[0] = (lensfun->tca_kr/100)+1;
-                       tca.Terms[1] = (lensfun->tca_kb/100)+1;
-                       /* Lensfun >= 0.2.5 - FIXME: Check version of lensfun 
library */
-                       //tca.Terms[0] = ((lensfun->tca_kr/100)*-1)+1;
-                       //tca.Terms[1] = ((lensfun->tca_kb/100)*-1)+1;
+                       if (LF_VERSION < 0x00020501)
+                       {
+                           /* Lensfun < 0.2.5.1 */
+                           tca.Terms[0] = (lensfun->tca_kr/100)+1;
+                           tca.Terms[1] = (lensfun->tca_kb/100)+1;
+                       }
+                       else
+                       {
+                           /* Lensfun >= 0.2.5.1 */
+                           tca.Terms[0] = ((lensfun->tca_kr/100)*-1)+1;
+                           tca.Terms[1] = ((lensfun->tca_kb/100)*-1)+1;
+                       }
                        lf_lens_add_calib_tca((lfLens *) 
lensfun->selected_lens, (lfLensCalibTCA *) &tca);
                } else
                {


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to