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

Comparing ray/src/meta/meta2bmp.c (file contents):
Revision 1.3 by greg, Tue Mar 19 19:34:41 2019 UTC vs.
Revision 1.5 by greg, Wed May 13 00:27:03 2020 UTC

# Line 24 | Line 24 | char  *progname;
24  
25   SCANBLOCK       outblock;
26  
27 < int  dxsize = DXSIZE, dysize = DYSIZE;
27 > int  dxsiz = DXSIZE, dysiz = DYSIZE;
28  
29   int  maxalloc = MAXALLOC;
30  
# Line 44 | Line 44 | static short  condonly = FALSE,
44  
45  
46   char *
47 < findtack(s)                     /* find place to tack on suffix */
48 < register char *s;
47 > findtack(char *s)               /* find place to tack on suffix */
48   {
49          while (*s && *s != '.')
50                  s++;
# Line 58 | Line 57 | main(
57          int  argc,
58          char  **argv
59   )
61
60   {
61   FILE  *fp;
62   char  comargs[200], command[300];
# Line 82 | Line 80 | main(
80            argc--;
81            break;
82         case 'x':
83 <          dxsize = atoi(*++argv);
83 >          dxsiz = atoi(*++argv);
84            argc--;
85            break;
86         case 'y':
87 <          dysize = atoi(*++argv);
87 >          dysiz = atoi(*++argv);
88            argc--;
89            break;
90         case 'o':
# Line 137 | Line 135 | main(
135      }
136  
137   return(0);
138 < }
138 > }
139  
140  
143
141   void
142   thispage(void)          /* rewind current file */
143   {
# Line 152 | Line 149 | thispage(void)         /* rewind current file */
149   void
150   initfile(void)          /* initialize this file */
151   {
155    /*
156    static unsigned char  cmap[24] = {255,255,255, 255,152,0, 0,188,0, 0,0,255,
157                        179,179,0, 255,0,255, 0,200,200, 0,0,0};
158     */
152      static const unsigned char  cmap[8][3] = {{0,0,0}, {0,0,255}, {0,188,0},
153                  {255,152,0}, {0,200,200}, {255,0,255}, {179,179,0}, {255,255,255}};
154      static int  filenum = 0;
155      BMPHeader  *hp;
156 <    register int  i;
156 >    int  i;
157  
158 <    hp = BMPmappedHeader(dxsize, dysize, 0, 256);
166 <    hp->compr = BI_RLE8;
158 >    hp = BMPmappedHeader(dxsiz, dysiz, 0, 256);
159      if (hp == NULL)
160          error(USER, "Illegal image parameter(s)");
161 +    hp->compr = BI_RLE8;
162      for (i = 0; i < 8; i++) {
163          hp->palette[i].r = cmap[i][2];
164          hp->palette[i].g = cmap[i][1];
# Line 183 | Line 176 | initfile(void)         /* initialize this file */
176   }
177  
178  
186
179   void
180   nextpage(void)          /* advance to next page */
189
181   {
182  
183      if (lineno == 0)
184          return;
185      if (bmpw != NULL) {
186 <        while (lineno < dysize) {
186 >        while (lineno < dysiz) {
187              nextblock();
188              outputblock();
189          }
# Line 204 | Line 195 | nextpage(void)         /* advance to next page */
195   }
196  
197  
207
198   #define MINRUN  4
199  
200 < extern void
200 > void
201   printblock(void)                /* output scanline block to file */
212
202   {
203      int  i;
204 <    register unsigned char  *scanline;
204 >    unsigned char  *scanline;
205  
206      if (lineno == 0)
207          initfile();
208 <    for (i = outblock.ybot; i <= outblock.ytop && i < dysize; i++) {
208 >    for (i = outblock.ybot; i <= outblock.ytop && i < dysiz; i++) {
209          scanline = outblock.cols[i-outblock.ybot] + outblock.xleft;
210          memcpy((void *)bmpw->scanline, (void *)scanline,
211                          sizeof(uint8)*(outblock.xright-outblock.xleft+1));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines