Update of /cvsroot/ufraw/ufraw
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14047

Modified Files:
        ufraw_preview.c 
Log Message:
Change all rint(x) to floor(x+0.5) since it turns out that rint(x) rounds
half-integer number to the nearest even integer! Fixes bug ID 2886414.


Index: ufraw_preview.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_preview.c,v
retrieving revision 1.299
retrieving revision 1.300
diff -u -d -r1.299 -r1.300
--- ufraw_preview.c     6 Nov 2009 06:42:03 -0000       1.299
+++ ufraw_preview.c     6 Nov 2009 06:47:53 -0000       1.300
@@ -2224,14 +2224,14 @@
                if (cy + dy > data->UF->rotatedHeight)
                    dy = data->UF->rotatedHeight - cy, fix_dx++;
                if (fix_dx) {
-                   double dx = rint(dy * 2.0 * aspect);
+                   double dx = floor(dy * 2.0 * aspect + 0.5);
                    if (cursor == left_cursor)
                        CFG->CropX1 = CFG->CropX2 - dx;
                    else
                        CFG->CropX2 = CFG->CropX1 + dx;
                }
-               CFG->CropY1 = rint(cy - dy);
-               CFG->CropY2 = rint(cy + dy);
+               CFG->CropY1 = floor(cy - dy + 0.5);
+               CFG->CropY2 = floor(cy + dy + 0.5);
            }
            break;
        case top_cursor:
@@ -2247,14 +2247,14 @@
                if (cx + dx > data->UF->rotatedWidth)
                    dx = data->UF->rotatedWidth - cx, fix_dy++;
                if (fix_dy) {
-                   double dy = rint(dx * 2.0 / aspect);
+                   double dy = floor(dx * 2.0 / aspect + 0.5);
                    if (cursor == top_cursor)
                        CFG->CropY1 = CFG->CropY2 - dy;
                    else
                        CFG->CropY2 = CFG->CropY1 + dy;
                }
-               CFG->CropX1 = rint(cx - dx);
-               CFG->CropX2 = rint(cx + dx);
+               CFG->CropX1 = floor(cx - dx + 0.5);
+               CFG->CropX2 = floor(cx + dx + 0.5);
            }
            break;
 
@@ -2354,10 +2354,10 @@
        dx = dy * data->AspectRatio;
     }
 
-    CFG->CropX1 = rint(cx - dx);
-    CFG->CropX2 = rint(cx + dx);
-    CFG->CropY1 = rint(cy - dy);
-    CFG->CropY2 = rint(cy + dy);
+    CFG->CropX1 = floor(cx - dx + 0.5);
+    CFG->CropX2 = floor(cx + dx + 0.5);
+    CFG->CropY1 = floor(cy - dy + 0.5);
+    CFG->CropY2 = floor(cy + dy + 0.5);
 
     update_crop_ranges(data);
 }


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs

Reply via email to