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

Comparing ray/src/px/mt160r.c (file contents):
Revision 1.2 by greg, Tue Sep 12 13:04:18 1989 UTC vs.
Revision 1.4 by greg, Fri Oct 20 20:35:59 1989 UTC

# Line 38 | Line 38 | char  *fname;
38   {
39          FILE  *input;
40          int  xres, yres;
41 <        COLOR  scanline[NCOLS];
41 >        COLR  scanline[NCOLS];
42          char  sbuf[256];
43          int  i;
44  
# Line 65 | Line 65 | char  *fname;
65          fputs("\033[6~\033[7z", stdout);
66          
67          for (i = yres-1; i >= 0; i--) {
68 <                if (freadscan(scanline, xres, input) < 0) {
68 >                if (freadcolrs(scanline, xres, input) < 0) {
69                          fprintf(stderr, "%s: read error (y=%d)\n", fname, i);
70                          return(-1);
71                  }
72 +                normcolrs(scanline, xres);
73                  plotscan(scanline, xres, i);
74          }
75  
# Line 81 | Line 82 | char  *fname;
82  
83  
84   plotscan(scan, len, y)                  /* plot a scanline */
85 < COLOR  scan[];
85 > COLR  scan[];
86   int  len;
87   int  y;
88   {
# Line 111 | Line 112 | int  y;
112   }
113  
114  
115 < bit(col, x)                             /* return bit for color at x */
116 < COLOR  col;
115 > bit(clr, x)                             /* return bit for color at x */
116 > COLR  clr;
117   register int  x;
118   {
119 <        static float  cerr[NCOLS];
120 <        static double  err;
121 <        double  b;
119 >        static int  cerr[NCOLS];
120 >        static int  err;
121 >        int  b;
122          register int  isblack;
123  
124 <        b = bright(col);
124 <        if (b > 1.0) b = 1.0;
124 >        b = normbright(clr);
125          err += b + cerr[x];
126 <        isblack = err < 0.5;
127 <        if (!isblack) err -= 1.0;
128 <        cerr[x] = err *= 0.5;
126 >        isblack = err < 128;
127 >        if (!isblack) err -= 256;
128 >        cerr[x] = err /= 2;
129          return(isblack);
130   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines