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

Comparing ray/src/px/ra_t8.c (file contents):
Revision 1.1 by greg, Thu Feb 2 10:49:37 1989 UTC vs.
Revision 1.3 by greg, Fri Oct 20 20:36:06 1989 UTC

# Line 122 | Line 122 | char  *argv[];
122                                          /* put header */
123                  printargs(argc, argv, stdout);
124                  putchar('\n');
125 <                printf("-Y %d +X %d\n", ymax, xmax);
125 >                fputresolu(YMAJOR|YDECR, xmax, ymax, stdout);
126                                          /* convert file */
127                  tg2ra(&head);
128          } else {
# Line 280 | Line 280 | register struct hdStruct  *h;
280                  return(NULL);
281                                          /* discard header */
282          getheader(p->fp, NULL);
283 <        if (fscanf(p->fp, "-Y %d +X %d\n", &ymax, &xmax) != 2)
283 >        if (fgetresolu(&xmax, &ymax, p->fp) != (YMAJOR|YDECR))
284                  quiterr("bad picture size");
285          p->nexty = 0;
286          p->bytes_line = 0;              /* variable length lines */
# Line 358 | Line 358 | picreadline3(y, l3)                    /* read in 3-byte scanline */
358   int  y;
359   register rgbpixel  *l3;
360   {
361 <        register BYTE   *l4;
362 <        register int    shift, c;
363 <        int     i;
361 >        register int    i;
362  
363 <        if (inpic->nexty != y) {                                /* find scanline */
363 >        if (inpic->nexty != y) {                        /* find scanline */
364                  if (inpic->bytes_line == 0) {
365                          if (inpic->pos.y[y] == 0) {
366                                  while (inpic->nexty < y) {
# Line 380 | Line 378 | register rgbpixel  *l3;
378                  quiterr("read error in picreadline3");
379          inpic->nexty = y+1;
380                                                          /* convert scanline */
381 <        for (l4=inline[0], i=xmax; i--; l4+=4, l3++) {
382 <                shift = l4[EXP] - COLXS;
383 <                if (shift >= 8) {
384 <                        l3->r = l3->g = l3->b = 255;
385 <                } else if (shift <= -8) {
388 <                        l3->r = l3->g = l3->b = 0;
389 <                } else if (shift > 0) {
390 <                        c = l4[RED] << shift;
391 <                        l3->r = c > 255 ? 255 : c;
392 <                        c = l4[GRN] << shift;
393 <                        l3->g = c > 255 ? 255 : c;
394 <                        c = l4[BLU] << shift;
395 <                        l3->b = c > 255 ? 255 : c;
396 <                } else if (shift < 0) {
397 <                        l3->r = l4[RED] >> -shift;
398 <                        l3->g = l4[GRN] >> -shift;
399 <                        l3->b = l4[BLU] >> -shift;
400 <                } else {
401 <                        l3->r = l4[RED];
402 <                        l3->g = l4[GRN];
403 <                        l3->b = l4[BLU];
404 <                }
381 >        normcolrs(inline, xmax);
382 >        for (i = 0; i < xmax; i++) {
383 >                l3[i].r = inline[i][RED];
384 >                l3[i].g = inline[i][GRN];
385 >                l3[i].b = inline[i][BLU];
386          }
387   }
388  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines