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

Comparing ray/src/px/oki20c.c (file contents):
Revision 1.6 by greg, Fri Oct 20 16:44:34 1989 UTC vs.
Revision 1.9 by greg, Tue Jul 10 09:07:48 1990 UTC

# Line 24 | Line 24 | static char SCCSid[] = "$SunId$ LBL";
24  
25   #define  sub_add(sub)   (2-(sub))       /* map subtractive to additive pri. */
26  
27 + #ifdef  BSD
28 + #define  clearlbuf()    bzero((char *)lpat, sizeof(lpat))
29 + #else
30 + #define  clearlbuf()    (void)memset((char *)lpat, 0, sizeof(lpat))
31 + #endif
32  
33 + long  lpat[NCOLS][3];
34 +
35 +
36   main(argc, argv)
37   int  argc;
38   char  *argv[];
# Line 68 | Line 76 | char  *fname;
76          }
77                                  /* set line spacing (overlap for knitting) */
78          fputs("\0333\042", stdout);
79 +                                /* clear line buffer */
80 +        clearlbuf();
81                                  /* put out scanlines */
82          for (i = yres-1; i >= 0; i--) {
83                  if (freadcolrs(scanline, xres, input) < 0) {
84                          fprintf(stderr, "%s: read error (y=%d)\n", fname, i);
85                          return(-1);
86                  }
87 <                normscan(scanline, xres);
87 >                normcolrs(scanline, xres, 0);
88                  plotscan(scanline, xres, i);
89          }
90                                  /* advance page */
# Line 86 | Line 96 | char  *fname;
96   }
97  
98  
89 normscan(scan, len)                     /* normalize a scanline */
90 register COLR  scan[];
91 int  len;
92 {
93        register int  i;
94
95        for (i = 0; i < len; i++)
96                colr_norm(scan[i], scan[i]);
97 }
98
99
99   plotscan(scan, len, y)                  /* plot a scanline */
100   COLR  scan[];
101   int  len;
102   int  y;
103   {
105        static long  pat[NCOLS][3];
104          int  bpos;
105          register long  c;
106          register int  i, j;
# Line 111 | Line 109 | int  y;
109  
110                  for (j = 0; j < 3; j++)
111                          for (i = 0; i < len; i++)
112 <                                pat[i][j] |= (long)colbit(scan[i],i,j) << bpos;
112 >                                lpat[i][j] |= (long)colbit(scan[i],i,j) << bpos;
113  
114          } else {
115  
# Line 122 | Line 120 | int  y;
120                          putchar(len & 255);
121                          putchar(len >> 8);
122                          for (i = 0; i < len; i++) {
123 <                                c = pat[i][j] | colbit(scan[i],i,j);
123 >                                c = lpat[i][j] | colbit(scan[i],i,j);
124                                                          /* repeat this row */
125 <                                pat[i][j] = (c & 1) << 23;
125 >                                lpat[i][j] = (c & 1) << 23;
126                                  putchar(c>>16);
127                                  putchar(c>>8 & 255);
128                                  putchar(c & 255);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines