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

Comparing ray/src/px/ximage.c (file contents):
Revision 2.3 by greg, Mon Dec 23 23:20:06 1991 UTC vs.
Revision 2.12 by schorsch, Mon Jun 30 14:59:12 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1987 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  ximage.c - driver for X-windows
6   *
# Line 18 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15   #include  <X/cursors/bcross_mask.cursor>
16  
17   #include  <sys/types.h>
18 <
18 > #include  <string.h>
19   #include  <ctype.h>
20 + #include  <time.h>
21  
22   #include  "color.h"
25
23   #include  "resolu.h"
27
24   #include  "xraster.h"
29
25   #include  "view.h"
31
26   #include  "pic.h"
33
27   #include  "random.h"
28  
29   #define  controlshift(e)        (((XButtonEvent *)(e))->detail & (ShiftMask|ControlMask))
# Line 86 | Line 79 | char  *progname;
79  
80   char  errmsg[128];
81  
89 extern long  ftell();
82  
91 extern char  *malloc(), *calloc();
92
93 extern double  pow(), log();
94
95
83   main(argc, argv)
84   int  argc;
85   char  *argv[];
86   {
87 +        extern char  *getenv();
88 +        char  *gv;
89          int  headline();
90          int  i;
91          
92          progname = argv[0];
93 +        if ((gv = getenv("DISPLAY_GAMMA")) != NULL)
94 +                gamcor = atof(gv);
95  
96          for (i = 1; i < argc; i++)
97                  if (argv[i][0] == '-')
# Line 167 | Line 158 | userr:
158   }
159  
160  
161 + int
162   headline(s)             /* get relevant info from header */
163   char  *s;
164   {
173        static char  *altname[] = {"rview","rpict",VIEWSTR,NULL};
174        register char  **an;
165          char  fmt[32];
166  
167          if (isexpos(s))
# Line 179 | Line 169 | char  *s;
169          else if (isformat(s)) {
170                  formatval(fmt, s);
171                  wrongformat = strcmp(fmt, COLRFMT);
172 <        } else
173 <                for (an = altname; *an != NULL; an++)
174 <                        if (!strncmp(*an, s, strlen(*an))) {
185 <                                if (sscanview(&ourview, s+strlen(*an)) > 0)
186 <                                        gotview++;
187 <                                return;
188 <                        }
172 >        } else if (isview(s) && sscanview(&ourview, s) > 0)
173 >                gotview++;
174 >        return(0);
175   }
176  
177  
# Line 254 | Line 240 | char  *err;
240   }
241  
242  
243 + void
244   eputs(s)
245   char    *s;
246   {
# Line 261 | Line 248 | char   *s;
248   }
249  
250  
251 + void
252   quit(code)
253   int  code;
254   {
# Line 574 | Line 562 | getmono()                      /* get monochrome data */
562                          cerr[x] = err + errp;
563                  }
564          }
565 <        free((char *)inl);
566 <        free((char *)cerr);
565 >        free((void *)inl);
566 >        free((void *)cerr);
567   }
568  
569  
# Line 603 | Line 591 | colormap       cmap;
591                          xr->cdefs[xr->ncolors].pixel = *p;
592                          xr->pmap[*p] = xr->ncolors++;
593                  }
594 <        xr->cdefs = (Color *)realloc((char *)xr->cdefs, xr->ncolors*sizeof(Color));
594 >        xr->cdefs = (Color *)realloc((void *)xr->cdefs, xr->ncolors*sizeof(Color));
595          if (xr->cdefs == NULL)
596                  return(0);
597          return(1);
# Line 647 | Line 635 | int  y;
635                  if (fseek(fin, scanpos[y], 0) == -1)
636                          quiterr("fseek error");
637                  cury = y;
638 <        } else if (scanpos != NULL)
638 >        } else if (scanpos != NULL && scanpos[y] == -1)
639                  scanpos[y] = ftell(fin);
640  
641          if (freadcolrs(scanline, xmax, fin) < 0)
# Line 680 | Line 668 | picwriteline(y, l)             /* add 8-bit scanline to image */
668   int  y;
669   pixel  *l;
670   {
671 <        bcopy((char *)l, (char *)ourras->data.bz+BZPixmapSize(xmax,y), BZPixmapSize(xmax,1));
671 >        memcpy((void *)ourras->data.bz+BZPixmapSize(xmax,y), (void *)l, BZPixmapSize(xmax,1));
672   }
673  
674  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines