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.3 by greg, Fri Oct 20 16:44:32 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                  }
# Line 81 | Line 81 | char  *fname;
81  
82  
83   plotscan(scan, len, y)                  /* plot a scanline */
84 < COLOR  scan[];
84 > COLR  scan[];
85   int  len;
86   int  y;
87   {
# Line 111 | Line 111 | int  y;
111   }
112  
113  
114 < bit(col, x)                             /* return bit for color at x */
115 < COLOR  col;
114 > bit(clr, x)                             /* return bit for color at x */
115 > COLR  clr;
116   register int  x;
117   {
118 <        static float  cerr[NCOLS];
119 <        static double  err;
120 <        double  b;
118 >        static int  cerr[NCOLS];
119 >        static int  err;
120 >        COLR  nclr;
121 >        int  b;
122          register int  isblack;
123  
124 <        b = bright(col);
125 <        if (b > 1.0) b = 1.0;
124 >        colr_norm(clr, nclr);
125 >        b = norm_bright(nclr);
126          err += b + cerr[x];
127 <        isblack = err < 0.5;
128 <        if (!isblack) err -= 1.0;
129 <        cerr[x] = err *= 0.5;
127 >        isblack = err < 128;
128 >        if (!isblack) err -= 256;
129 >        cerr[x] = err /= 2;
130          return(isblack);
131   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines