Update of /cvsroot/ufraw/ufraw
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11405

Modified Files:
        ufraw.h ufraw_conf.c ufraw_preview.c ufraw_ufraw.c 
Log Message:
Fix bug #371: Lensfun distortion correction affects crop area even if 'autofit' 
deselected. Thanks goes to Frank Markesteijn for the patch.

Index: ufraw_preview.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_preview.c,v
retrieving revision 1.385
retrieving revision 1.386
diff -u -d -r1.385 -r1.386
--- ufraw_preview.c     24 Jan 2015 10:00:16 -0000      1.385
+++ ufraw_preview.c     9 Feb 2015 16:30:14 -0000       1.386
@@ -2104,6 +2104,7 @@
 
     refresh_aspect(data);
     set_new_aspect(data);
+    CFG->fullCrop = enabled_state;
     CFG->autoCrop = disabled_state;
     auto_button_toggle(data->AutoCropButton, &CFG->autoCrop);
 }
@@ -3009,6 +3010,7 @@
             if ((int *)valuep == &CFG->CropY1) cursor = top_cursor;
             if ((int *)valuep == &CFG->CropY2) cursor = bottom_cursor;
             fix_crop_aspect(data, cursor, TRUE);
+            CFG->fullCrop = disabled_state;
             CFG->autoCrop = disabled_state;
             auto_button_toggle(data->AutoCropButton, &CFG->autoCrop);
         }

Index: ufraw_conf.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_conf.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -d -r1.198 -r1.199
--- ufraw_conf.c        24 Jan 2015 10:00:16 -0000      1.198
+++ ufraw_conf.c        9 Feb 2015 16:30:14 -0000       1.199
@@ -39,6 +39,7 @@
     digital_highlights, /* clipHighlights */
     disabled_state, /* autoExposure */
     disabled_state, /* autoBlack */
+    enabled_state, /* fullCrop */
     disabled_state, /* autoCrop */
     camera_curve, camera_curve + 1, /* BaseCurveIndex, BaseCurveCount */
     /* BaseCurve data defaults */
@@ -1338,6 +1339,8 @@
     dst->autoExposure = src->autoExposure;
     dst->autoBlack = src->autoBlack;
     dst->autoCrop = src->autoCrop;
+    if (src->autoCrop == enabled_state)
+        dst->fullCrop = disabled_state;
     dst->restoreDetails = src->restoreDetails;
     dst->clipHighlights = src->clipHighlights;
     memcpy(dst->lightnessAdjustment, src->lightnessAdjustment,
@@ -1445,6 +1448,12 @@
     dst->CropY2 = src->CropY2;
     dst->aspectRatio = src->aspectRatio;
     dst->rotationAngle = src->rotationAngle;
+
+    if (src->CropX1 != -1 || src->CropX2 != -1 ||
+            src->CropY1 != -1 || src->CropY2 != -1) {
+        dst->fullCrop = disabled_state;
+        dst->autoCrop = disabled_state;
+    }
 }
 
 /* Copy the 'save options' from *src to *dst */
@@ -1487,10 +1496,14 @@
     if (cmd->embeddedImage != -1) conf->embeddedImage = cmd->embeddedImage;
     if (cmd->rotate != -1) conf->rotate = cmd->rotate;
     if (cmd->rotationAngle != NULLF) conf->rotationAngle = cmd->rotationAngle;
-    if (cmd->autoCrop != -1) conf->autoCrop = cmd->autoCrop;
+    if (cmd->autoCrop != -1)
+        if ((conf->autoCrop = cmd->autoCrop) == enabled_state)
+            conf->fullCrop = disabled_state;
     if (cmd->CropX1 != -1 || cmd->CropX2 != -1 ||
-            cmd->CropY1 != -1 || cmd->CropY2 != -1)
+            cmd->CropY1 != -1 || cmd->CropY2 != -1) {
+        conf->fullCrop = disabled_state;
         conf->autoCrop = disabled_state;
+    }
     if (cmd->CropX1 != -1) conf->CropX1 = cmd->CropX1;
     if (cmd->CropY1 != -1) conf->CropY1 = cmd->CropY1;
     if (cmd->CropX2 != -1) conf->CropX2 = cmd->CropX2;
@@ -1897,6 +1910,7 @@
     cmd->CropY1 = -1;
     cmd->CropX2 = -1;
     cmd->CropY2 = -1;
+    cmd->fullCrop = -1;
     cmd->autoCrop = -1;
     cmd->aspectRatio = 0.0;
     cmd->rotate = -1;

Index: ufraw_ufraw.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_ufraw.c,v
retrieving revision 1.284
retrieving revision 1.285
diff -u -d -r1.284 -r1.285
--- ufraw_ufraw.c       24 Jan 2015 10:00:16 -0000      1.284
+++ ufraw_ufraw.c       9 Feb 2015 16:30:14 -0000       1.285
@@ -351,7 +351,7 @@
     return UFRAW_SUCCESS;
 }
 
-// Get the dimensions of the unshrunk, rotated image.
+// Get the dimensions of the unshrunk, rotated image.autoCrop
 // The crop coordinates are calculated based on these dimensions.
 void ufraw_get_image_dimensions(ufraw_data *uf)
 {
@@ -360,12 +360,14 @@
 
     ufraw_get_image(uf, ufraw_transform_phase, FALSE);
 
-    if (uf->conf->CropX1 < 0) uf->conf->CropX1 = 0;
-    if (uf->conf->CropY1 < 0) uf->conf->CropY1 = 0;
-    if (uf->conf->CropX2 < 0) uf->conf->CropX2 = uf->rotatedWidth;
-    if (uf->conf->CropY2 < 0) uf->conf->CropY2 = uf->rotatedHeight;
+    if (uf->conf->fullCrop || uf->conf->CropX1 < 0) uf->conf->CropX1 = 0;
+    if (uf->conf->fullCrop || uf->conf->CropY1 < 0) uf->conf->CropY1 = 0;
+    if (uf->conf->fullCrop || uf->conf->CropX2 < 0) uf->conf->CropX2 = 
uf->rotatedWidth;
+    if (uf->conf->fullCrop || uf->conf->CropY2 < 0) uf->conf->CropY2 = 
uf->rotatedHeight;
 
-    if (uf->conf->aspectRatio <= 0) {
+    if (uf->conf->fullCrop)
+        uf->conf->aspectRatio = (double)uf->rotatedWidth / uf->rotatedHeight;
+    else if (uf->conf->aspectRatio <= 0) {
         if (uf->conf->autoCrop)
             /* preserve the initial aspect ratio - this should be consistent
                with ufraw_convert_prepare_transform */

Index: ufraw.h
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw.h,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -d -r1.176 -r1.177
--- ufraw.h     24 Jan 2015 10:00:16 -0000      1.176
+++ ufraw.h     9 Feb 2015 16:30:13 -0000       1.177
@@ -253,7 +253,7 @@
     double exposure, saturation, black; /* black is only used in CMD */
     int ExposureNorm;
     int restoreDetails, clipHighlights;
-    int autoExposure, autoBlack, autoCrop;
+    int autoExposure, autoBlack, fullCrop, autoCrop;
     int BaseCurveIndex, BaseCurveCount;
     CurveData BaseCurve[max_curves];
     int curveIndex, curveCount;


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
ufraw-cvs mailing list
ufraw-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs

Reply via email to