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.7 by greg, Thu Aug 30 11:21:34 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 601 | Line 603 | getmono()                      /* get monochrome data */
603          register unsigned char  *dp;
604          register int    x, err;
605          int     y;
606 <        rgbpixel        *inline;
606 >        rgbpixel        *inl;
607          short   *cerr;
608  
609 <        if ((inline = (rgbpixel *)malloc(xmax*sizeof(rgbpixel))) == NULL
609 >        if ((inl = (rgbpixel *)malloc(xmax*sizeof(rgbpixel))) == NULL
610                          || (cerr = (short *)calloc(xmax,sizeof(short))) == NULL)
611                  quit("out of memory in getmono");
612          dp = ourdata - 1;
613          for (y = 0; y < ymax; y++) {
614 <                picreadline3(y, inline);
614 >                picreadline3(y, inl);
615                  err = 0;
616                  for (x = 0; x < xmax; x++) {
617                          if (!(x&7))
618                                  *++dp = 0;
619 <                        err += rgb_bright(&inline[x]) + cerr[x];
619 >                        err += rgb_bright(&inl[x]) + cerr[x];
620                          if (err > 127)
621                                  err -= 255;
622                          else
# Line 622 | Line 624 | getmono()                      /* get monochrome data */
624                          cerr[x] = err >>= 1;
625                  }
626          }
627 <        free((char *)inline);
627 >        free((char *)inl);
628          free((char *)cerr);
629   }
630  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines