better way of clamping snohalo1->blur to [0,1]

This commit is contained in:
Nicolas Robidoux 2009-03-31 15:17:25 +00:00
parent d874d85ec0
commit 5b02ff84c5

View File

@ -533,19 +533,6 @@ vips_interpolate_snohalo1_interpolate( VipsInterpolate* restrict interpolate,
*/ */
const PEL* restrict p = (PEL *) IM_REGION_ADDR( in, ix, iy ); const PEL* restrict p = (PEL *) IM_REGION_ADDR( in, ix, iy );
/*
* Clamp blur parameter to [0,1]:
*/
const double requested_blur = snohalo1->blur;
const double blur =
(
requested_blur >= 0.
?
( requested_blur <= 1. ? requested_blur : 1. )
:
0.
);
/* /*
* Double bands for complex images: * Double bands for complex images:
*/ */
@ -557,7 +544,7 @@ vips_interpolate_snohalo1_interpolate( VipsInterpolate* restrict interpolate,
p, \ p, \
bands, \ bands, \
lskip, \ lskip, \
blur, \ snohalo1->blur, \
relative_x, \ relative_x, \
relative_y ); relative_y );
@ -629,8 +616,8 @@ vips_interpolate_snohalo1_class_init( VipsInterpolateSnohalo1Class *klass )
pspec = pspec =
g_param_spec_double( "blur", g_param_spec_double( "blur",
_( "Blur" ), _( "Blur" ),
_( "Antialiasing blur amount: 0. = none, 1. = max" ), _( "Antialiasing (diagonal straightening) blur amount" ),
0, 4, 1, 0., 1., 1.,
(GParamFlags) G_PARAM_READWRITE ); (GParamFlags) G_PARAM_READWRITE );
g_object_class_install_property( gobject_class, g_object_class_install_property( gobject_class,
PROP_BLUR, pspec ); PROP_BLUR, pspec );