ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/pcond4.c
(Generate patch)

Comparing ray/src/px/pcond4.c (file contents):
Revision 3.5 by greg, Fri Oct 4 18:11:52 1996 UTC vs.
Revision 3.7 by greg, Sat Oct 5 11:17:10 1996 UTC

# Line 126 | Line 126 | int    y;
126          register int    x, i;
127  
128          vy = dy = (y+.5)/numscans(&inpres)*fvyr - .5;
129 <        if (vy >= fvyr-1) vy--;
129 >        while (vy >= fvyr-1) vy--;
130          dy -= (double)vy;
131          for (x = 0; x < scanlen(&inpres); x++) {
132                  vx = dx = (x+.5)/scanlen(&inpres)*fvxr - .5;
133 <                if (vx >= fvxr-1) vx--;
133 >                while (vx >= fvxr-1) vx--;
134                  dx -= (double)vx;
135                  for (i = 0; i < 3; i++) {
136                          lv = (1.-dy)*colval(veilscan(vy)[vx],i) +
# Line 204 | Line 204 | int    y;
204          register COLOR  *sl0, *sl1, *mysl;
205          register int    i;
206  
207 <        if (y < sb->nread - sb->nscans) {
208 <                fprintf(stderr, "%s: internal - cannot backspace in getascan\n",
209 <                                progname);
210 <                exit(1);
211 <        }
207 >        if (y < sb->nread - sb->nscans)                 /* too far back? */
208 >                return(NULL);
209          for ( ; y >= sb->nread; sb->nread++) {          /* read as necessary */
210                  mysl = bscan(sb, sb->nread);
211                  if (sb->sampr == 1) {
# Line 219 | Line 216 | int    y;
216                          }
217                  } else {
218                          sl0 = getascan(sb->next, 2*y);
219 +                        if (sl0 == NULL)
220 +                                return(NULL);
221                          sl1 = getascan(sb->next, 2*y+1);
222                          for (i = 0; i < sb->len; i++) {
223                                  copycolor(mysl[i], sl0[2*i]);
# Line 291 | Line 290 | SCANBAR        *sb;
290          double  dx, dy;
291          int     ix, iy;
292  
293 +        if (sb->sampr == 1) {           /* no need to interpolate */
294 +                sl0 = getascan(sb, y);
295 +                copycolor(col, sl0[x]);
296 +                return;
297 +        }
298 +                                        /* compute coordinates for sb */
299          ix = dx = (x+.5)/sb->sampr - .5;
300 <        if (ix >= sb->len-1) ix--;
300 >        while (ix >= sb->len-1) ix--;
301          dx -= (double)ix;
302          iy = dy = (y+.5)/sb->sampr - .5;
303 <        if (iy >= numscans(&inpres)/sb->sampr-1) iy--;
303 >        while (iy >= numscans(&inpres)/sb->sampr-1) iy--;
304          dy -= (double)iy;
305                                          /* get scanlines */
306          sl0 = getascan(sb, iy);
307 +        if (sl0 == NULL) {
308 +                fprintf(stderr, "%s: internal - cannot backspace in ascanval\n",
309 +                                progname);
310 +                exit(1);
311 +        }
312          sl1 = getascan(sb, iy+1);
313                                          /* 2D linear interpolation */
314          copycolor(col, sl0[ix]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines