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

Comparing ray/src/meta/meta2tga.c (file contents):
Revision 1.6 by greg, Wed Feb 4 18:49:24 2004 UTC vs.
Revision 1.9 by greg, Wed May 13 00:30:13 2020 UTC

# Line 13 | Line 13 | static const char      RCSid[] = "$Id$";
13   #include  "rast.h"
14   #include  "targa.h"
15  
16 < #define  MAXALLOC  30000
16 > #define  MAXALLOC  100000
17   #define  DXSIZE  400            /* default x resolution */
18   #define  DYSIZE  400            /* default y resolution */
19   #define  XCOM  "pexpand +vOCImsp -DP %s | psort +y"
# Line 23 | Line 23 | char  *progname;
23  
24   SCANBLOCK       outblock;
25  
26 < int  dxsize = DXSIZE, dysize = DYSIZE;
26 > int  dxsiz = DXSIZE, dysiz = DYSIZE;
27  
28   int  maxalloc = MAXALLOC;
29  
# Line 44 | Line 44 | static int putthead(struct hdStruct  *hp, char  *ip, F
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 83 | Line 81 | main(
81            argc--;
82            break;
83         case 'x':
84 <          dxsize = atoi(*++argv);
84 >          dxsiz = atoi(*++argv);
85            argc--;
86            break;
87         case 'y':
88 <          dysize = atoi(*++argv);
88 >          dysiz = atoi(*++argv);
89            argc--;
90            break;
91         case 'o':
# Line 138 | Line 136 | main(
136      }
137  
138   return(0);
139 < }
139 > }
140  
141  
144
142   void
143   thispage(void)          /* rewind current file */
144   {
# Line 153 | Line 150 | thispage(void)         /* rewind current file */
150   void
151   initfile(void)          /* initialize this file */
152   {
153 <    static int  filenum = 0;
157 <    /*
158 <    static unsigned char  cmap[24] = {255,255,255, 255,152,0, 0,188,0, 0,0,255,
159 <                        179,179,0, 255,0,255, 0,200,200, 0,0,0};
160 <     */
161 <    static unsigned char  cmap[24] = {0,0,0, 0,0,255, 0,188,0, 255,152,0,
153 >    static const unsigned char  cmap[24] = {0,0,0, 0,0,255, 0,188,0, 255,152,0,
154                          0,200,200, 255,0,255, 179,179,0, 255,255,255};
155 +    static int  filenum = 0;
156      struct hdStruct  thead;
157 <    register int  i;
157 >    int  i;
158  
159      if (outtack != NULL) {
160          sprintf(outtack, "%d.tga", ++filenum);
# Line 176 | Line 169 | initfile(void)         /* initialize this file */
169      thead.CMapBits = 24;
170      thead.XOffset = 0;
171      thead.YOffset = 0;
172 <    thead.x = dxsize;
173 <    thead.y = dysize;
172 >    thead.x = dxsiz;
173 >    thead.y = dysiz;
174      thead.dataBits = 8;
175      thead.imType = 0;
176      putthead(&thead, NULL, fout);
# Line 188 | Line 181 | initfile(void)         /* initialize this file */
181   }
182  
183  
191
184   void
185   nextpage(void)          /* advance to next page */
194
186   {
187  
188      if (lineno == 0)
189          return;
190      if (fout != NULL) {
191 <        while (lineno < dysize) {
191 >        while (lineno < dysiz) {
192              nextblock();
193              outputblock();
194          }
# Line 209 | Line 200 | nextpage(void)         /* advance to next page */
200   }
201  
202  
212
203   #define MINRUN  4
204  
205 < extern void
205 > void
206   printblock(void)                /* output scanline block to file */
217
207   {
208      int  i, c2;
209 <    register unsigned char  *scanline;
210 <    register int  j, beg, cnt = 0;
209 >    unsigned char  *scanline;
210 >    int  j, beg, cnt = 0;
211  
212      if (lineno == 0)
213          initfile();
214 <    for (i = outblock.ybot; i <= outblock.ytop && i < dysize; i++) {
214 >    for (i = outblock.ybot; i <= outblock.ytop && i < dysiz; i++) {
215          scanline = outblock.cols[i-outblock.ybot];
216          for (j = outblock.xleft; j <= outblock.xright; j += cnt) {
217              for (beg = j; beg <= outblock.xright; beg += cnt) {
# Line 252 | Line 241 | printblock(void)               /* output scanline block to file */
241  
242   void
243   putint2(                        /* put a 2-byte positive integer */
244 <        register int  i,
245 <        register FILE   *fp
244 >        int  i,
245 >        FILE    *fp
246   )
247   {
248          putc(i&0xff, fp);
# Line 265 | Line 254 | int
254   putthead(               /* write header to output */
255          struct hdStruct  *hp,
256          char  *ip,
257 <        register FILE  *fp
257 >        FILE  *fp
258   )
259   {
260          if (ip != NULL)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines