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.47 by greg, Mon Apr 21 13:10:12 1997 UTC vs.
Revision 2.48 by greg, Tue Apr 22 10:01:43 1997 UTC

# Line 944 | Line 944 | COLOR  clr;
944  
945   make_tonemap()                  /* initialize tone mapping */
946   {
947 <        int  y;
947 >        int  flags, y;
948  
949          if (tmflags != -1 && fname == NULL) {
950                  fprintf(stderr, "%s: cannot adjust tone of standard input\n",
# Line 955 | Line 955 | make_tonemap()                 /* initialize tone mapping */
955                  setcolrcor(pow, 1.0/gamcor);
956                  return;
957          }
958 <        if (greyscale)
959 <                tmflags |= TM_F_BW;
958 >        if (tmTop != NULL)              /* already initialized? */
959 >                return;
960 >        flags = tmflags;
961 >        if (greyscale) flags |= TM_F_BW;
962                                          /* initialize tm library */
963 <        if (tmInit(tmflags, stdprims, gamcor) == NULL)
963 >        if (tmInit(flags, stdprims, gamcor) == NULL)
964                  goto memerr;
965          if (tmSetSpace(stdprims, WHTEFFICACY/exposure))
966                  goto tmerr;
967                                          /* allocate encoding buffers */
968          if ((lscan = (TMbright *)malloc(xmax*sizeof(TMbright))) == NULL)
969                  goto memerr;
970 <        if (tmflags & TM_F_BW) {
970 >        if (greyscale) {
971                  cscan = TM_NOCHROM;
972                  if ((pscan = (BYTE *)malloc(sizeof(BYTE)*xmax)) == NULL)
973                          goto memerr;
# Line 982 | Line 984 | make_tonemap()                 /* initialize tone mapping */
984                                          /* compute tone mapping */
985          if (tmComputeMapping(gamcor, 0., 0.))
986                  goto tmerr;
985        free((char *)lscan);
987          return;
988   memerr:
989          quiterr("out of memory in make_tonemap");
# Line 1010 | Line 1011 | int  len;
1011          if (tmMapPixels(pscan, lscan, cscan, len))
1012                  goto tmerr;
1013          ps = pscan;
1014 <        if (tmflags & TM_F_BW)
1014 >        if (greyscale)
1015                  while (len--) {
1016                          scn[0][RED] = scn[0][GRN] = scn[0][BLU] = *ps++;
1017                          scn[0][EXP] = COLXS;
# Line 1030 | Line 1031 | tmerr:
1031   }
1032  
1033  
1033 done_tonemap()                  /* clean up after tone mapping is done */
1034 {
1035        if (tmflags == -1 || tmTop == NULL)
1036                return;
1037        tmDone(tmTop);                  /* clear old mapping */
1038        free((char *)lscan);            /* free memory */
1039        free((char *)pscan);
1040 }
1041
1042
1034   getmono()                       /* get monochrome data */
1035   {
1036          register unsigned char  *dp;
# Line 1148 | Line 1139 | getfull()                      /* get full (24-bit) data */
1139                                          (unsigned int4)scanline[x][GRN] << 8 |
1140                                          (unsigned int4)scanline[x][BLU] << 16 ;
1141          }
1151        done_tonemap();
1142   }
1143  
1144  
# Line 1176 | Line 1166 | getgrey()                      /* get greyscale data */
1166          for (x = 0; x < maxcolors; x++)
1167                  clrtab[x][RED] = clrtab[x][GRN] =
1168                          clrtab[x][BLU] = ((int4)x*256 + 128)/maxcolors;
1179        done_tonemap();
1169   }
1170  
1171  
# Line 1209 | Line 1198 | getmapped()                    /* get color-mapped data */
1198                  else
1199                          map_colrs(ourdata+y*xmax, scanline, xmax);
1200          }
1212        done_tonemap();
1201   }
1202  
1203  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines