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

Comparing ray/src/px/ra_t16.c (file contents):
Revision 1.10 by greg, Wed Dec 12 14:40:07 1990 UTC vs.
Revision 1.12 by greg, Fri May 17 08:41:52 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 96 | Line 96 | char  *argv[];
96                          quiterr("incompatible format");
97                                          /* put header */
98                  printargs(i, argv, stdout);
99 +                fputformat(COLRFMT, stdout);
100                  putchar('\n');
101                  fputresolu(YMAJOR|YDECR, head.x, head.y, stdout);
102                                          /* convert file */
103                  tg2ra(&head);
104          } else {
105 <                getheader(stdin, NULL);
106 <                if (fgetresolu(&head.x, &head.y, stdin) != (YMAJOR|YDECR))
105 >                if (checkheader(stdin, COLRFMT, NULL) < 0 ||
106 >                        fgetresolu(&head.x, &head.y, stdin) != (YMAJOR|YDECR))
107                          quiterr("bad picture file");
108                                          /* assign header */
109                  head.textSize = 0;
# Line 290 | Line 291 | struct hdStruct  *hp;
291                  colrs_gambs(inl, hp->x);
292                  if (hp->dataBits == 16) {
293                          register unsigned short  *dp;
294 +                        register int  v;
295                          dp = (unsigned short *)tarData + j*hp->x;
296                          for (i = 0; i < hp->x; i++) {
297 <                                *dp = ((inl[i][RED]+(random()&7)) & 0xf8)<<7;
298 <                                *dp |= ((inl[i][GRN]+(random()&7)) & 0xf8)<<2;
299 <                                *dp++ |= (inl[i][BLU]+(random()&7))>>3;
297 >                                v = inl[i][RED] + (random()&7);
298 >                                if (v > 255) v = 255;
299 >                                *dp = (v&0xf8)<<7;
300 >                                v = inl[i][GRN] + (random()&7);
301 >                                if (v > 255) v = 255;
302 >                                *dp |= (v&0xf8)<<2;
303 >                                v = inl[i][BLU] + (random()&7);
304 >                                if (v > 255) v = 255;
305 >                                *dp++ |= v>>3;
306                          }
307                  } else {        /* hp->dataBits == 24 */
308                          register unsigned char  *dp;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines