From c570bf902e79d79a269315ee618cbf891b63b5ee Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 16 Jan 2013 11:50:34 +0000 Subject: [PATCH] revert recent changes to nohalo/vsqbs revert the changes to nohalo/vsqbs that were suppoed to switch to corner convention, they broke addressing this needs rethinking --- libvips/resample/nohalo.cpp | 8 ++++++-- libvips/resample/vsqbs.cpp | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libvips/resample/nohalo.cpp b/libvips/resample/nohalo.cpp index 251a3789..d0a2c5be 100644 --- a/libvips/resample/nohalo.cpp +++ b/libvips/resample/nohalo.cpp @@ -230,6 +230,10 @@ * http://doi.acm.org/10.1145/1557626.1557657. */ +/* Uncomment to enable bounds checking for VIPS_REGION_ADDR(). + */ +#define DEBUG + #ifdef HAVE_CONFIG_H #include #endif /*HAVE_CONFIG_H*/ @@ -1489,8 +1493,8 @@ vips_interpolate_nohalo_interpolate( VipsInterpolate* restrict interpolate, * * It's 2 not 0 since we ask for a window_offset of 2 at the bottom. */ - const int ix = (int) absolute_x; - const int iy = (int) absolute_y; + const int ix = (int) (absolute_x + 0.5); + const int iy = (int) (absolute_y + 0.5); /* * Move the pointer to (the first band of) the top/left pixel of the diff --git a/libvips/resample/vsqbs.cpp b/libvips/resample/vsqbs.cpp index 9973ad41..1cb66aaa 100644 --- a/libvips/resample/vsqbs.cpp +++ b/libvips/resample/vsqbs.cpp @@ -313,8 +313,8 @@ vips_interpolate_vsqbs_interpolate( VipsInterpolate* restrict interpolate, * * It's 1 not 0 since we ask for a window_offset of 1 at the bottom. */ - const int ix = (int) absolute_x; - const int iy = (int) absolute_y; + const int ix = (int) (absolute_x + 0.5); + const int iy = (int) (absolute_y + 0.5); /* * Move the pointer to (the first band of) the top/left pixel of the