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

Comparing ray/src/px/oki20.c (file contents):
Revision 2.3 by greg, Fri Jul 3 08:59:24 1992 UTC vs.
Revision 2.4 by greg, Fri Jul 3 10:30:07 1992 UTC

# Line 6 | Line 6 | static char SCCSid[] = "$SunId$ LBL";
6  
7   /*
8   *  oki20c.c - program to dump pixel file to OkiMate 20 color printer.
9 *
10 *     6/10/87
9   */
10  
11   #include  <stdio.h>
# Line 96 | Line 94 | char  *fname;
94                  return(-1);
95          }
96                                  /* set line spacing (overlap for knitting) */
97 <        fputs("\0333\042", stdout);
97 >        fputs("\0333\042\022", stdout);
98                                  /* clear line buffer */
99          clearlbuf();
100                                  /* put out scanlines */
# Line 125 | Line 123 | COLR  scan[];
123   int  len;
124   int  y;
125   {
126 <        int  bpos;
126 >        int  bpos, start, end;
127          register long  c;
128          register int  i;
129  
130 <        if (bpos = y % 23) {
130 >        bpos = y % 23;
131 >        for (i = 0; i < len; i++)
132 >                lpat[i] |= (long)bit(scan[i],i) << bpos;
133  
134 <                for (i = 0; i < len; i++)
135 <                        lpat[i] |= (long)bit(scan[i],i) << bpos;
136 <
137 <        } else {
138 <
139 <                fputs("\033%O", stdout);
140 <                putchar(len & 255);
141 <                putchar(len >> 8);
142 <                for (i = 0; i < len; i++) {
143 <                        c = lpat[i] | bit(scan[i],i);
144 <                                                /* repeat this row */
145 <                        lpat[i] = (c & 1) << 23;
146 <                        putchar(c>>16);
147 <                        putchar(c>>8 & 255);
148 <                        putchar(c & 255);
134 >        if (bpos)
135 >                return;
136 >                                /* find limits of non-zero print buffer */
137 >        for (i = 0; lpat[i] == 0; i++)
138 >                if (i == len-1) {
139 >                        putchar('\n');
140 >                        return;
141                  }
142 <                putchar('\r');
143 <                putchar('\n');
144 <                fflush(stdout);
142 >        start = i - i%12;
143 >        i = len;
144 >        while (lpat[--i] == 0)
145 >                ;
146 >        end = i;
147 >                                /* skip to start position */
148 >        for (i = start/12; i-- > 0; )
149 >                putchar(' ');
150 >                                /* print non-zero portion of buffer */
151 >        fputs("\033%O", stdout);
152 >        i = end+1-start;
153 >        putchar(i & 255);
154 >        putchar(i >> 8);
155 >        for (i = start; i <= end; i++) {
156 >                c = lpat[i];
157 >                putchar(c>>16);
158 >                putchar(c>>8 & 255);
159 >                putchar(c & 255);
160 >                                        /* repeat this row next time */
161 >                lpat[i] = (c & 1) << 23;
162          }
163 +        putchar('\r');
164 +        putchar('\n');
165 +        fflush(stdout);
166   }
167  
168  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines