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

Comparing ray/src/px/x11image.c (file contents):
Revision 2.56 by greg, Sat Feb 22 02:07:28 2003 UTC vs.
Revision 2.62 by greg, Mon Jul 7 17:21:51 2003 UTC

# Line 1 | Line 1
1   #ifndef lint
2 < static const char       RCSid[] = "$Id$";
2 > static const char RCSid[] = "$Id";
3   #endif
4   /*
5   *  x11image.c - driver for X-windows
# Line 18 | Line 18 | static const char      RCSid[] = "$Id$";
18  
19   #include  "standard.h"
20  
21 + #include  <string.h>
22   #include  <signal.h>
23   #include  <X11/Xlib.h>
24   #include  <X11/cursorfont.h>
# Line 125 | Line 126 | Atom  closedownAtom, wmProtocolsAtom;
126  
127   int  sigrecv;
128  
129 < int  onsig() { sigrecv++; }
129 > void  onsig(int i) { sigrecv++; }
130  
131  
132   main(argc, argv)
# Line 537 | Line 538 | getras()                               /* get raster file */
538                          goto fail;
539                  getmono();
540          } else if (ourvis.class == TrueColor | ourvis.class == DirectColor) {
541 <                int  datsiz = ourvis.depth>16 ? sizeof(int4) : sizeof(int2);
541 >                int  datsiz = ourvis.depth>16 ? sizeof(int32) : sizeof(int16);
542                  ourdata = (unsigned char *)malloc(datsiz*xmax*ymax);
543                  if (ourdata == NULL)
544                          goto fail;
# Line 625 | Line 626 | getevent()                             /* process the next event */
626   traceray(xpos, ypos)                    /* print requested pixel data */
627   int  xpos, ypos;
628   {
629 <        extern char  *index();
629 <        FLOAT  hv[2];
629 >        RREAL  hv[2];
630          FVECT  rorg, rdir;
631          COLOR  cval;
632          register char  *cp;
# Line 674 | Line 674 | XKeyPressedEvent  *ekey;
674          XColor  cvx;
675          int  com, n;
676          double  comp;
677 <        FLOAT  hv[2];
677 >        RREAL  hv[2];
678  
679          n = XLookupString(ekey, buf, sizeof(buf), NULL, NULL);
680          if (n == 0)
# Line 892 | Line 892 | int  x0, y0, x1, y1;
892   }
893  
894  
895 < int
895 > void
896   colavg(scn, n, cavg)
897   register COLR   *scn;
898   register int    n;
# Line 926 | Line 926 | COLOR  cavg;
926  
927   int
928   dobox(f, p)                             /* run function over bbox */
929 < int     (*f)();                 /* function to call for each subscan */
929 > void    (*f)();                 /* function to call for each subscan */
930   char    *p;                     /* pointer to private data */
931   {
932          int  left, right, top, bottom;
# Line 957 | Line 957 | char   *p;                     /* pointer to private data */
957   }
958  
959  
960 < int
960 > void
961   addfix(scn, n)                  /* add fixation points to histogram */
962   COLR    *scn;
963   int     n;
# Line 1153 | Line 1153 | COLR  *scan;
1153   getfull()                       /* get full (24-bit) data */
1154   {
1155          int     y;
1156 <        register unsigned int4  *dp;
1157 <        register unsigned int2  *dph;
1156 >        register uint32 *dp;
1157 >        register uint16 *dph;
1158          register int    x;
1159                                          /* initialize tone mapping */
1160          make_tonemap();
1161                                          /* read and convert file */
1162 <        dp = (unsigned int4 *)ourdata;
1163 <        dph = (unsigned int2 *)ourdata;
1162 >        dp = (uint32 *)ourdata;
1163 >        dph = (uint16 *)ourdata;
1164          for (y = 0; y < ymax; y++) {
1165                  getscan(y);
1166                  add2icon(y, scanline);
# Line 1168 | Line 1168 | getfull()                      /* get full (24-bit) data */
1168                  switch (ourras->image->blue_mask) {
1169                  case 0xff:              /* 24-bit RGB */
1170                          for (x = 0; x < xmax; x++)
1171 <                                *dp++ = (unsigned int4)scanline[x][RED] << 16 |
1172 <                                        (unsigned int4)scanline[x][GRN] << 8 |
1173 <                                        (unsigned int4)scanline[x][BLU] ;
1171 >                                *dp++ = (uint32)scanline[x][RED] << 16 |
1172 >                                        (uint32)scanline[x][GRN] << 8 |
1173 >                                        (uint32)scanline[x][BLU] ;
1174                          break;
1175                  case 0xff0000:          /* 24-bit BGR */
1176                          for (x = 0; x < xmax; x++)
1177 <                                *dp++ = (unsigned int4)scanline[x][RED] |
1178 <                                        (unsigned int4)scanline[x][GRN] << 8 |
1179 <                                        (unsigned int4)scanline[x][BLU] << 16 ;
1177 >                                *dp++ = (uint32)scanline[x][RED] |
1178 >                                        (uint32)scanline[x][GRN] << 8 |
1179 >                                        (uint32)scanline[x][BLU] << 16 ;
1180                          break;
1181   #if 0
1182                  case 0x1f:              /* 15-bit RGB */
# Line 1232 | Line 1232 | getgrey()                      /* get greyscale data */
1232                  tmap_colrs(scanline, xmax);
1233                  if (maxcolors < 256)
1234                          for (x = 0; x < xmax; x++)
1235 <                                *dp++ = ((int4)scanline[x][GRN] *
1235 >                                *dp++ = ((int32)scanline[x][GRN] *
1236                                          maxcolors + maxcolors/2) >> 8;
1237                  else
1238                          for (x = 0; x < xmax; x++)
# Line 1240 | Line 1240 | getgrey()                      /* get greyscale data */
1240          }
1241          for (x = 0; x < maxcolors; x++)
1242                  clrtab[x][RED] = clrtab[x][GRN] =
1243 <                        clrtab[x][BLU] = ((int4)x*256 + 128)/maxcolors;
1243 >                        clrtab[x][BLU] = ((int32)x*256 + 128)/maxcolors;
1244   }
1245  
1246  
# Line 1253 | Line 1253 | getmapped()                    /* get color-mapped data */
1253                                          /* initialize tone mapping */
1254          make_tonemap();
1255                                          /* make histogram */
1256 <        if (new_histo((int4)xmax*ymax) == -1)
1256 >        if (new_histo((int32)xmax*ymax) == -1)
1257                  quiterr("cannot initialize histogram");
1258          for (y = 0; y < ymax; y++) {
1259                  if (getscan(y) < 0)
# Line 1310 | Line 1310 | int  y;
1310          static int  trunced = -1;               /* truncated file? */
1311   skipit:
1312          if (trunced >= 0 && y >= trunced) {
1313 <                bzero(scanline, xmax*sizeof(COLR));
1313 >                memset(scanline, '\0', xmax*sizeof(COLR));
1314                  return(-1);
1315          }
1316          if (y != cury) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines