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

Comparing ray/src/px/x11image.c (file contents):
Revision 1.5 by greg, Wed Mar 7 11:39:26 1990 UTC vs.
Revision 1.8 by greg, Sat Oct 13 21:31:48 1990 UTC

# Line 308 | Line 308 | getras()                               /* get raster file */
308                  if (ourras == NULL)
309                          goto fail;
310                  getmono();
311 <        } else if (XMatchVisualInfo(thedisplay,ourscreen,24,TrueColor,&vinfo)) {
311 >        } else if (XMatchVisualInfo(thedisplay,ourscreen,24,TrueColor,&vinfo)
312 >                                                /* kludge for DirectColor */
313 >        || XMatchVisualInfo(thedisplay,ourscreen,24,DirectColor,&vinfo)) {
314                  ourdata = (unsigned char *)malloc(xmax*ymax*3);
315                  if (ourdata == NULL)
316                          goto fail;
# Line 443 | Line 445 | XKeyPressedEvent  *ekey;
445                          XBell(thedisplay, 0);
446                          return(-1);
447                  }
448 <                viewray(rorg, rdir, &ourview,
448 >                if (viewray(rorg, rdir, &ourview,
449                                  (ekey->x-xoff+.5)/xmax,
450 <                                (ymax-1-ekey->y+yoff+.5)/ymax);
450 >                                (ymax-1-ekey->y+yoff+.5)/ymax) < 0)
451 >                        return(-1);
452                  printf("%e %e %e ", rorg[0], rorg[1], rorg[2]);
453                  printf("%e %e %e\n", rdir[0], rdir[1], rdir[2]);
454                  fflush(stdout);
# Line 601 | Line 604 | getmono()                      /* get monochrome data */
604          register unsigned char  *dp;
605          register int    x, err;
606          int     y;
607 <        rgbpixel        *inline;
607 >        rgbpixel        *inl;
608          short   *cerr;
609  
610 <        if ((inline = (rgbpixel *)malloc(xmax*sizeof(rgbpixel))) == NULL
610 >        if ((inl = (rgbpixel *)malloc(xmax*sizeof(rgbpixel))) == NULL
611                          || (cerr = (short *)calloc(xmax,sizeof(short))) == NULL)
612                  quit("out of memory in getmono");
613          dp = ourdata - 1;
614          for (y = 0; y < ymax; y++) {
615 <                picreadline3(y, inline);
615 >                picreadline3(y, inl);
616                  err = 0;
617                  for (x = 0; x < xmax; x++) {
618                          if (!(x&7))
619                                  *++dp = 0;
620 <                        err += rgb_bright(&inline[x]) + cerr[x];
620 >                        err += rgb_bright(&inl[x]) + cerr[x];
621                          if (err > 127)
622                                  err -= 255;
623                          else
# Line 622 | Line 625 | getmono()                      /* get monochrome data */
625                          cerr[x] = err >>= 1;
626                  }
627          }
628 <        free((char *)inline);
628 >        free((char *)inl);
629          free((char *)cerr);
630   }
631  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines