oop, affine coordinate error

we were offsetting the input image incorrectly, compare
the way the transform is set up in vips_affine_build() and
im__affinei()

see https://github.com/jcupitt/libvips/issues/131
This commit is contained in:
John Cupitt 2014-06-17 14:18:12 +01:00
parent b7f16a1de9
commit 519898a7ac
2 changed files with 13 additions and 6 deletions

4
TODO
View File

@ -1,3 +1,7 @@
- can we call affine from nip2 vips_call? do we need a double array?
- the docs reference vips__temp_name() several times, but we don't doc it
where should we discuss the temporary directory? vips_image_new_temp_file()

View File

@ -111,9 +111,8 @@
*/
/*
#define DEBUG
#define DEBUG_GEOMETRY
*/
#define DEBUG
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -355,7 +354,10 @@ vips_affine_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
/* Clipping!
*/
if( fx < ile || fx >= iri || fy < ito || fy >= ibo ) {
if( fx < ile ||
fx >= iri ||
fy < ito ||
fy >= ibo ) {
for( z = 0; z < ps; z++ )
q[z] = 0;
}
@ -415,8 +417,8 @@ vips_affine_build( VipsObject *object )
window_offset =
vips_interpolate_get_window_offset( affine->interpolate );
affine->trn.iarea.left = window_offset;
affine->trn.iarea.top = window_offset;
affine->trn.iarea.left = 0;
affine->trn.iarea.top = 0;
affine->trn.iarea.width = in->Xsize;
affine->trn.iarea.height = in->Ysize;
affine->trn.a = ((double *) affine->matrix->data)[0];
@ -456,7 +458,8 @@ vips_affine_build( VipsObject *object )
* output space inside INT_MAX / TRANSFORM_SCALE.
*/
edge = INT_MAX / VIPS_TRANSFORM_SCALE;
if( affine->trn.oarea.left < -edge || affine->trn.oarea.top < -edge ||
if( affine->trn.oarea.left < -edge ||
affine->trn.oarea.top < -edge ||
VIPS_RECT_RIGHT( &affine->trn.oarea ) > edge ||
VIPS_RECT_BOTTOM( &affine->trn.oarea ) > edge ) {
vips_error( class->nickname,