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.4 by schorsch, Mon Oct 27 10:28:59 2003 UTC vs.
Revision 1.8 by greg, Mon Nov 18 22:12:32 2019 UTC

# Line 13 | Line 13 | static const char      RCSid[] = "$Id$";
13   #include  "rast.h"
14   #include  "targa.h"
15  
16 < #define  MAXALLOC  5000
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 39 | Line 39 | static int  lineno = 0;
39   static short  condonly = FALSE,
40                conditioned = FALSE;
41  
42 + static int putthead(struct hdStruct  *hp, char  *ip, FILE  *fp);
43 +
44 +
45 +
46   char *
47   findtack(s)                     /* find place to tack on suffix */
48   register char *s;
# Line 49 | Line 53 | register char *s;
53   }
54  
55  
56 < main(argc, argv)
56 > int
57 > main(
58 >        int  argc,
59 >        char  **argv
60 > )
61  
54 int  argc;
55 char  **argv;
56
62   {
63   FILE  *fp;
64   char  comargs[200], command[300];
# Line 78 | Line 83 | char  **argv;
83            argc--;
84            break;
85         case 'x':
86 <          dxsize = atoi(*++argv);
86 >          dxsiz = atoi(*++argv);
87            argc--;
88            break;
89         case 'y':
90 <          dysize = atoi(*++argv);
90 >          dysiz = atoi(*++argv);
91            argc--;
92            break;
93         case 'o':
# Line 137 | Line 142 | char  **argv;
142  
143  
144  
145 <
146 <
142 <
143 < thispage()              /* rewind current file */
145 > void
146 > thispage(void)          /* rewind current file */
147   {
148      if (lineno)
149          error(USER, "cannot restart page in thispage");
150   }
151  
152  
153 <
154 < initfile()              /* initialize this file */
153 > void
154 > initfile(void)          /* initialize this file */
155   {
156      static int  filenum = 0;
157      /*
# Line 173 | Line 176 | initfile()             /* initialize this file */
176      thead.CMapBits = 24;
177      thead.XOffset = 0;
178      thead.YOffset = 0;
179 <    thead.x = dxsize;
180 <    thead.y = dysize;
179 >    thead.x = dxsiz;
180 >    thead.y = dysiz;
181      thead.dataBits = 8;
182      thead.imType = 0;
183      putthead(&thead, NULL, fout);
# Line 186 | Line 189 | initfile()             /* initialize this file */
189  
190  
191  
192 + void
193 + nextpage(void)          /* advance to next page */
194  
190 nextpage()              /* advance to next page */
191
195   {
196  
197      if (lineno == 0)
198          return;
199      if (fout != NULL) {
200 <        while (lineno < dysize) {
200 >        while (lineno < dysiz) {
201              nextblock();
202              outputblock();
203          }
# Line 209 | Line 212 | nextpage()             /* advance to next page */
212  
213   #define MINRUN  4
214  
215 + extern void
216 + printblock(void)                /* output scanline block to file */
217  
213 printblock()            /* output scanline block to file */
214
218   {
219      int  i, c2;
220      register unsigned char  *scanline;
221 <    register int  j, beg, cnt;
221 >    register int  j, beg, cnt = 0;
222  
223      if (lineno == 0)
224          initfile();
225 <    for (i = outblock.ybot; i <= outblock.ytop && i < dysize; i++) {
225 >    for (i = outblock.ybot; i <= outblock.ytop && i < dysiz; i++) {
226          scanline = outblock.cols[i-outblock.ybot];
227          for (j = outblock.xleft; j <= outblock.xright; j += cnt) {
228              for (beg = j; beg <= outblock.xright; beg += cnt) {
# Line 247 | Line 250 | printblock()           /* output scanline block to file */
250   }
251  
252  
253 < putint2(i, fp)                  /* put a 2-byte positive integer */
254 < register int  i;
255 < register FILE   *fp;
253 > void
254 > putint2(                        /* put a 2-byte positive integer */
255 >        register int  i,
256 >        register FILE   *fp
257 > )
258   {
259          putc(i&0xff, fp);
260          putc(i>>8&0xff, fp);
261   }
262  
263  
264 < putthead(hp, ip, fp)            /* write header to output */
265 < struct hdStruct  *hp;
266 < char  *ip;
267 < register FILE  *fp;
264 > int
265 > putthead(               /* write header to output */
266 >        struct hdStruct  *hp,
267 >        char  *ip,
268 >        register FILE  *fp
269 > )
270   {
271          if (ip != NULL)
272                  putc(strlen(ip), fp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines