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.29 by greg, Wed Oct 27 13:03:18 1993 UTC vs.
Revision 2.30 by greg, Wed Oct 27 16:57:28 1993 UTC

# Line 970 | Line 970 | getgrey()                      /* get greyscale data */
970   getmapped()                     /* get color-mapped data */
971   {
972          int     y;
973 +                                        /* make sure we can do it first */
974 +        if (fname == NULL)
975 +                quiterr("cannot map colors from standard input");
976                                          /* set gamma correction */
977          setcolrgam(gamcor);
978                                          /* make histogram */
979          new_histo();
980          for (y = 0; y < ymax; y++) {
981                  if (getscan(y) < 0)
982 <                        quiterr("seek error in getmapped");
982 >                        break;
983                  add2icon(y, scanline);
984                  if (scale)
985                          shiftcolrs(scanline, xmax, scale);
# Line 987 | Line 990 | getmapped()                    /* get color-mapped data */
990          if (!new_clrtab(maxcolors))
991                  quiterr("cannot create color map");
992          for (y = 0; y < ymax; y++) {
993 <                if (getscan(y) < 0)
991 <                        quiterr("seek error in getmapped");
993 >                getscan(y);
994                  if (scale)
995                          shiftcolrs(scanline, xmax, scale);
996                  colrs_gambs(scanline, xmax);
# Line 1031 | Line 1033 | double sf;
1033   getscan(y)
1034   int  y;
1035   {
1036 +        static int  trunced = -1;               /* truncated file? */
1037 + skipit:
1038 +        if (trunced >= 0 && y >= trunced) {
1039 +                bzero(scanline, xmax*sizeof(COLR));
1040 +                return(-1);
1041 +        }
1042          if (y != cury) {
1043                  if (scanpos == NULL || scanpos[y] == -1)
1044                          return(-1);
# Line 1040 | Line 1048 | int  y;
1048          } else if (scanpos != NULL && scanpos[y] == -1)
1049                  scanpos[y] = ftell(fin);
1050  
1051 <        if (freadcolrs(scanline, xmax, fin) < 0)
1052 <                quiterr("read error");
1053 <
1051 >        if (freadcolrs(scanline, xmax, fin) < 0) {
1052 >                fprintf(stderr, "%s: %s: unfinished picture\n",
1053 >                                progname, fname==NULL?"<stdin>":fname);
1054 >                trunced = y;
1055 >                goto skipit;
1056 >        }
1057          cury++;
1058          return(0);
1059   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines