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

Comparing ray/src/px/pinterp.c (file contents):
Revision 1.26 by greg, Tue Mar 6 12:04:56 1990 UTC vs.
Revision 1.28 by greg, Fri Mar 16 19:19:52 1990 UTC

# Line 454 | Line 454 | double z;
454                  y1 = p0->y + c1*s1y/l1;
455                  for (c2 = l2; c2-- > 0; ) {
456                          x = x1 + c2*s2x/l2;
457 +                        if (x < 0 || x >= hresolu)
458 +                                continue;
459                          y = y1 + c2*s2y/l2;
460 +                        if (y < 0 || y >= vresolu)
461 +                                continue;
462                          if (zscan(y)[x] <= 0 || zscan(y)[x]-z
463                                                  > zeps*zscan(y)[x]) {
464                                  zscan(y)[x] = z;
# Line 519 | Line 523 | int    samp;
523                                  }
524                                  /*
525                                   * If we have no background for this pixel,
522                                 * or if the background is too distant,
526                                   * use the given fill function.
527                                   */
528 <                                if ((xback < 0 && yback[x] < 0)
529 <                                        || (samp > 0
527 <                                                && ABS(x-xback) >= samp
528 <                                                && ABS(y-yback[y]) >= samp)) {
529 <                                        (*fill)(x,y);
530 <                                        if (fill != backfill) { /* reuse */
531 <                                                yback[x] = -2;
532 <                                                xback = -2;
533 <                                        }
534 <                                        continue;
535 <                                }
528 >                                if (xback < 0 && yback[x] < 0)
529 >                                        goto fillit;
530                                  /*
531                                   * Compare, and use the background that is
532                                   * farther, unless one of them is next to us.
533 +                                 * If the background is too distant, call
534 +                                 * the fill function.
535                                   */
536                                  if ( yback[x] < 0
537                                          || (xback >= 0 && ABS(x-xback) <= 1)
538                                          || ( ABS(y-yback[x]) > 1
539                                                  && zscan(yback[x])[x]
540                                                  < zscan(y)[xback] ) ) {
541 +                                        if (samp > 0 && ABS(x-xback) >= samp)
542 +                                                goto fillit;
543                                          copycolr(pscan(y)[x],pscan(y)[xback]);
544                                          zscan(y)[x] = zscan(y)[xback];
545                                  } else {
546 +                                        if (samp > 0 && ABS(y-yback[x]) > samp)
547 +                                                goto fillit;
548                                          copycolr(pscan(y)[x],pscan(yback[x])[x]);
549                                          zscan(y)[x] = zscan(yback[x])[x];
550 +                                }
551 +                                continue;
552 +                        fillit:
553 +                                (*fill)(x,y);
554 +                                if (fill == rcalfill) {         /* use it */
555 +                                        clearqueue();
556 +                                        xback = x;
557 +                                        yback[x] = y;
558                                  }
559                          } else {                                /* full pixel */
560                                  yback[x] = -2;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines