Update of /cvsroot/ufraw/ufraw In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11338
Modified Files: ufobject.cc ufraw_ufraw.c Log Message: Add floor() before converting to int to fix compiler rounding issues. Index: ufobject.cc =================================================================== RCS file: /cvsroot/ufraw/ufraw/ufobject.cc,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- ufobject.cc 1 Jan 2013 04:00:17 -0000 1.17 +++ ufobject.cc 26 Feb 2013 19:23:18 -0000 1.18 @@ -492,8 +492,8 @@ { if (index < 0 || index >= Size()) Throw("index (%d) out of range 0..%d", index, Size() - 1); - int newValue = number / ufnumberarray->Accuracy + 0.5; - int oldValue = ufnumberarray->Array[index] / ufnumberarray->Accuracy + 0.5; + int newValue = floor(number / ufnumberarray->Accuracy + 0.5); + int oldValue = floor(ufnumberarray->Array[index] / ufnumberarray->Accuracy + 0.5); return oldValue == newValue; } Index: ufraw_ufraw.c =================================================================== RCS file: /cvsroot/ufraw/ufraw/ufraw_ufraw.c,v retrieving revision 1.272 retrieving revision 1.273 diff -u -d -r1.272 -r1.273 --- ufraw_ufraw.c 1 Jan 2013 04:00:17 -0000 1.272 +++ ufraw_ufraw.c 26 Feb 2013 19:23:18 -0000 1.273 @@ -378,15 +378,15 @@ int cropWidth = uf->conf->CropX2 - uf->conf->CropX1; int cropHeight = uf->conf->CropY2 - uf->conf->CropY1; - if (cropWidth != (int)(cropHeight * uf->conf->aspectRatio + 0.5)) { + if (cropWidth != (int)floor(cropHeight * uf->conf->aspectRatio + 0.5)) { /* aspectRatio does not match the crop area - shrink the area */ if ((double)cropWidth / cropHeight > uf->conf->aspectRatio) { - cropWidth = cropHeight * uf->conf->aspectRatio + 0.5; + cropWidth = floor(cropHeight * uf->conf->aspectRatio + 0.5); uf->conf->CropX1 = (uf->conf->CropX1 + uf->conf->CropX2 - cropWidth) / 2; uf->conf->CropX2 = uf->conf->CropX1 + cropWidth; } else { - cropHeight = cropWidth / uf->conf->aspectRatio + 0.5; + cropHeight = floor(cropWidth / uf->conf->aspectRatio + 0.5); uf->conf->CropY1 = (uf->conf->CropY1 + uf->conf->CropY2 - cropHeight) / 2; uf->conf->CropY2 = uf->conf->CropY1 + cropHeight; } @@ -1448,9 +1448,9 @@ uf->autoCropWidth = iWidth; uf->autoCropHeight = iHeight; if ((double)uf->autoCropWidth / uf->autoCropHeight > aspectRatio) - uf->autoCropWidth = uf->autoCropHeight * aspectRatio + 0.5; + uf->autoCropWidth = floor(uf->autoCropHeight * aspectRatio + 0.5); else - uf->autoCropHeight = uf->autoCropWidth / aspectRatio + 0.5; + uf->autoCropHeight = floor(uf->autoCropWidth / aspectRatio + 0.5); return; } @@ -1510,9 +1510,9 @@ uf->autoCropHeight = MIN(floor(2 * minY) * scale, 2 * iHeight); if ((double)uf->autoCropWidth / uf->autoCropHeight > aspectRatio) - uf->autoCropWidth = uf->autoCropHeight * aspectRatio + 0.5; + uf->autoCropWidth = floor(uf->autoCropHeight * aspectRatio + 0.5); else - uf->autoCropHeight = uf->autoCropWidth / aspectRatio + 0.5; + uf->autoCropHeight = floor(uf->autoCropWidth / aspectRatio + 0.5); int newWidth = uf->rotatedWidth * width / iWidth; int newHeight = uf->rotatedHeight * height / iHeight; ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb _______________________________________________ ufraw-cvs mailing list ufraw-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ufraw-cvs