--- ray/src/util/glareval.c 2010/12/02 18:08:11 2.13 +++ ray/src/util/glareval.c 2018/08/02 18:33:50 2.16 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: glareval.c,v 2.13 2010/12/02 18:08:11 greg Exp $"; +static const char RCSid[] = "$Id: glareval.c,v 2.16 2018/08/02 18:33:50 greg Exp $"; #endif /* * Compute pixels for glare calculation @@ -177,9 +177,7 @@ pict_val( /* find picture value for view direction * pp[0] = pictview.vp[0] + vd[0]; pp[1] = pictview.vp[1] + vd[1]; pp[2] = pictview.vp[2] + vd[2]; - viewloc(ip, &pictview, pp); - if (ip[2] <= FTINY || ip[0] < 0. || ip[0] >= 1. || - ip[1] < 0. || ip[1] >= 1.) + if (viewloc(ip, &pictview, pp) != 1) return(-1.0); colr_color(res, getpictscan((int)(ip[1]*pysiz))[(int)(ip[0]*pxsiz)]); return(luminance(res)/exposure); @@ -249,8 +247,10 @@ getviewspan( /* compute a span of view pixels */ /* send to rtrace */ if (n >= maxpix) { /* flush */ rt_compute(rt_buf, n); - while (n-- > 0) + while (n > 0) { + --n; vb[buf_vh[n]+hsize] = luminance(rt_buf+3*n); + } } rt_buf[6*n] = ourview.vp[0]; rt_buf[6*n+1] = ourview.vp[1]; @@ -299,7 +299,7 @@ getexpos( /* get exposure from header line */ void *p ) { - char fmt[32]; + char fmt[MAXFMTLEN]; if (isexpos(s)) exposure *= exposval(s);