--- ray/src/px/x11image.c 2003/06/08 12:03:10 2.58 +++ ray/src/px/x11image.c 2003/07/07 17:21:51 2.62 @@ -18,6 +18,7 @@ static const char RCSid[] = "$Id"; #include "standard.h" +#include #include #include #include @@ -537,7 +538,7 @@ getras() /* get raster file */ goto fail; getmono(); } else if (ourvis.class == TrueColor | ourvis.class == DirectColor) { - int datsiz = ourvis.depth>16 ? sizeof(int4) : sizeof(int2); + int datsiz = ourvis.depth>16 ? sizeof(int32) : sizeof(int16); ourdata = (unsigned char *)malloc(datsiz*xmax*ymax); if (ourdata == NULL) goto fail; @@ -625,7 +626,7 @@ getevent() /* process the next event */ traceray(xpos, ypos) /* print requested pixel data */ int xpos, ypos; { - FLOAT hv[2]; + RREAL hv[2]; FVECT rorg, rdir; COLOR cval; register char *cp; @@ -673,7 +674,7 @@ XKeyPressedEvent *ekey; XColor cvx; int com, n; double comp; - FLOAT hv[2]; + RREAL hv[2]; n = XLookupString(ekey, buf, sizeof(buf), NULL, NULL); if (n == 0) @@ -891,7 +892,7 @@ int x0, y0, x1, y1; } -int +void colavg(scn, n, cavg) register COLR *scn; register int n; @@ -925,7 +926,7 @@ COLOR cavg; int dobox(f, p) /* run function over bbox */ -int (*f)(); /* function to call for each subscan */ +void (*f)(); /* function to call for each subscan */ char *p; /* pointer to private data */ { int left, right, top, bottom; @@ -956,7 +957,7 @@ char *p; /* pointer to private data */ } -int +void addfix(scn, n) /* add fixation points to histogram */ COLR *scn; int n; @@ -1152,14 +1153,14 @@ COLR *scan; getfull() /* get full (24-bit) data */ { int y; - register unsigned int4 *dp; - register unsigned int2 *dph; + register uint32 *dp; + register uint16 *dph; register int x; /* initialize tone mapping */ make_tonemap(); /* read and convert file */ - dp = (unsigned int4 *)ourdata; - dph = (unsigned int2 *)ourdata; + dp = (uint32 *)ourdata; + dph = (uint16 *)ourdata; for (y = 0; y < ymax; y++) { getscan(y); add2icon(y, scanline); @@ -1167,15 +1168,15 @@ getfull() /* get full (24-bit) data */ switch (ourras->image->blue_mask) { case 0xff: /* 24-bit RGB */ for (x = 0; x < xmax; x++) - *dp++ = (unsigned int4)scanline[x][RED] << 16 | - (unsigned int4)scanline[x][GRN] << 8 | - (unsigned int4)scanline[x][BLU] ; + *dp++ = (uint32)scanline[x][RED] << 16 | + (uint32)scanline[x][GRN] << 8 | + (uint32)scanline[x][BLU] ; break; case 0xff0000: /* 24-bit BGR */ for (x = 0; x < xmax; x++) - *dp++ = (unsigned int4)scanline[x][RED] | - (unsigned int4)scanline[x][GRN] << 8 | - (unsigned int4)scanline[x][BLU] << 16 ; + *dp++ = (uint32)scanline[x][RED] | + (uint32)scanline[x][GRN] << 8 | + (uint32)scanline[x][BLU] << 16 ; break; #if 0 case 0x1f: /* 15-bit RGB */ @@ -1231,7 +1232,7 @@ getgrey() /* get greyscale data */ tmap_colrs(scanline, xmax); if (maxcolors < 256) for (x = 0; x < xmax; x++) - *dp++ = ((int4)scanline[x][GRN] * + *dp++ = ((int32)scanline[x][GRN] * maxcolors + maxcolors/2) >> 8; else for (x = 0; x < xmax; x++) @@ -1239,7 +1240,7 @@ getgrey() /* get greyscale data */ } for (x = 0; x < maxcolors; x++) clrtab[x][RED] = clrtab[x][GRN] = - clrtab[x][BLU] = ((int4)x*256 + 128)/maxcolors; + clrtab[x][BLU] = ((int32)x*256 + 128)/maxcolors; } @@ -1252,7 +1253,7 @@ getmapped() /* get color-mapped data */ /* initialize tone mapping */ make_tonemap(); /* make histogram */ - if (new_histo((int4)xmax*ymax) == -1) + if (new_histo((int32)xmax*ymax) == -1) quiterr("cannot initialize histogram"); for (y = 0; y < ymax; y++) { if (getscan(y) < 0) @@ -1309,7 +1310,7 @@ int y; static int trunced = -1; /* truncated file? */ skipit: if (trunced >= 0 && y >= trunced) { - bzero(scanline, xmax*sizeof(COLR)); + memset(scanline, '\0', xmax*sizeof(COLR)); return(-1); } if (y != cury) {