Update of /cvsroot/ufraw/ufraw
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29993
Modified Files:
ufraw_ufraw.c
Log Message:
Fix some corner cases for 100% zoom.
Index: ufraw_ufraw.c
===================================================================
RCS file: /cvsroot/ufraw/ufraw/ufraw_ufraw.c,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -d -r1.190 -r1.191
--- ufraw_ufraw.c 29 Sep 2009 16:45:36 -0000 1.190
+++ ufraw_ufraw.c 29 Sep 2009 21:30:19 -0000 1.191
@@ -704,31 +704,25 @@
int ufraw_convert_image_init(ufraw_data *uf)
{
dcraw_data *raw = uf->raw;
- int temp_height, temp_width;
- // This code is copied from dcraw_image_dimensions().
- if (raw->pixel_aspect < 1)
- temp_height = (int)(raw->raw.height / raw->pixel_aspect + 0.5);
- else
- temp_height = raw->raw.height;
- if (raw->pixel_aspect > 1)
- temp_width = (int)(raw->raw.width * raw->pixel_aspect + 0.5);
- else
- temp_width = raw->raw.width;
uf->ConvertShrink = 1;
/* We can do a simple interpolation in the following cases:
* We shrink by an integer value.
* If pixel_aspect<1 (e.g. NIKON D1X) shrink must be at least 4. */
- if (uf->conf->size==0 && uf->conf->shrink>1)
- uf->ConvertShrink = uf->conf->shrink * raw->pixel_aspect;
- else if (uf->conf->interpolation==half_interpolation)
+ if (uf->conf->size==0 && uf->conf->shrink>1) {
+ double pixel_aspect = MIN(raw->pixel_aspect, 1/raw->pixel_aspect);
+ uf->ConvertShrink = uf->conf->shrink * pixel_aspect;
+ } else if (uf->conf->interpolation==half_interpolation) {
uf->ConvertShrink = 2;
/* Wanted size is smaller than raw size (size is after a raw->shrink)
* (assuming there are filters). */
- else if ( uf->conf->size>0 && uf->HaveFilters &&
- uf->conf->size<=MAX(temp_height, temp_width) )
- uf->ConvertShrink = 2;
-
+ } else if (uf->conf->size>0 && uf->HaveFilters) {
+ int cropHeight = uf->conf->CropY2 - uf->conf->CropY1;
+ int cropWidth = uf->conf->CropX2 - uf->conf->CropX1;
+ int cropSize = MAX(cropHeight, cropWidth);
+ if (cropSize/uf->conf->size >= 2)
+ uf->ConvertShrink = 2;
+ }
return UFRAW_SUCCESS;
}
@@ -1043,7 +1037,7 @@
} else {
/* uf->conf->size holds the size of the cropped image.
* We need to calculate from it the desired size of
- * th uncropped image. */
+ * the uncropped image. */
int finalSize = uf->ConvertShrink * MAX(final.height, final.width);
uf->ConvertShrink = cropSize / uf->conf->size;
dcraw_image_resize(&final, uf->conf->size * finalSize / cropSize);
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
ufraw-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ufraw-cvs