From f948b6e7248fb041be88cd01c9df3e81d192f32f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Thu, 27 Mar 1997 18:32:21 +0100 Subject: [PATCH] image->tuned_box() now works again. float<=>int bug. Rev: src/modules/Image/image.c:1.19 --- src/modules/Image/image.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/modules/Image/image.c b/src/modules/Image/image.c index 903478014b..caba77f413 100644 --- a/src/modules/Image/image.c +++ b/src/modules/Image/image.c @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.18 1997/03/25 06:13:41 mirar Exp $ */ +/* $Id: image.c,v 1.19 1997/03/27 17:32:21 grubba Exp $ */ /* **! module Image @@ -12,7 +12,7 @@ #include "stralloc.h" #include "global.h" -RCSID("$Id: image.c,v 1.18 1997/03/25 06:13:41 mirar Exp $"); +RCSID("$Id: image.c,v 1.19 1997/03/27 17:32:21 grubba Exp $"); #include "types.h" #include "pike_macros.h" #include "object.h" @@ -1073,6 +1073,7 @@ void image_tuned_box(INT32 args) rgba_group topleft,topright,bottomleft,bottomright,sum,sumzero={0,0,0,0}; rgb_group *img; struct image *this; + float dxw, dyw; if (args<5|| sp[-args].type!=T_INT|| @@ -1107,6 +1108,9 @@ void image_tuned_box(INT32 args) xw=x2-x1; yw=y2-y1; + dxw = 1.0/(float)xw; + dyw = 1.0/(float)yw; + this=THIS; THREADS_ALLOW(); @@ -1114,9 +1118,8 @@ void image_tuned_box(INT32 args) { #define tune_factor(a,aw) (1.0-((float)(a)*(aw))) INT32 ymax; - float dyw=1/yw; - float tfx1=tune_factor(x,1/xw); - float tfx2=tune_factor(xw-x,1/xw); + float tfx1=tune_factor(x,dxw); + float tfx2=tune_factor(xw-x,dxw); ymax=min(yw,this->ysize-y1); img=this->img+x+x1+this->xsize*max(0,y1); -- GitLab