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.67 by greg, Sat Apr 10 03:02:20 2004 UTC vs.
Revision 2.71 by greg, Sun Jul 24 19:53:08 2005 UTC

# Line 1 | Line 1
1   #ifndef lint
2 < static const char RCSid[] = "$Id";
2 > static const char RCSid[] = "$Id$";
3   #endif
4   /*
5   *  x11image.c - driver for X-windows
# Line 98 | Line 98 | double  exposure = 1.0;                        /* exposure compensation use
98  
99   int  wrongformat = 0;                   /* input in another format? */
100  
101 + TMstruct        *tmGlobal;              /* base tone-mapping */
102 + TMstruct        *tmCurrent;             /* curren tone-mapping */
103 +
104   GC      ourgc;                          /* standard graphics context */
105   GC      revgc;                          /* graphics context with GXinvert */
106  
# Line 394 | Line 397 | init(                  /* get data and open window */
397          windowName.encoding = iconName.encoding = XA_STRING;
398          windowName.format = iconName.format = 8;
399          windowName.value = (u_char *)name;
400 <        windowName.nitems = strlen(windowName.value);
400 >        windowName.nitems = strlen((char *)windowName.value);
401          iconName.value = (u_char *)name;
402 <        iconName.nitems = strlen(windowName.value);
402 >        iconName.nitems = strlen((char *)windowName.value);
403  
404          xclshints.res_name = NULL;
405          xclshints.res_class = "Ximage";
# Line 568 | Line 571 | getras(void)                           /* get raster file */
571                  ourdata = (unsigned char *)malloc(ymax*((xmax+7)/8));
572                  if (ourdata == NULL)
573                          goto fail;
574 <                ourras = make_raster(thedisplay, &ourvis, 1, ourdata,
574 >                ourras = make_raster(thedisplay, &ourvis, 1, (char *)ourdata,
575                                  xmax, ymax, 8);
576                  if (ourras == NULL)
577                          goto fail;
# Line 579 | Line 582 | getras(void)                           /* get raster file */
582                  if (ourdata == NULL)
583                          goto fail;
584                  ourras = make_raster(thedisplay, &ourvis, datsiz*8,
585 <                                ourdata, xmax, ymax, datsiz*8);
585 >                                (char *)ourdata, xmax, ymax, datsiz*8);
586                  if (ourras == NULL)
587                          goto fail;
588                  getfull();
# Line 587 | Line 590 | getras(void)                           /* get raster file */
590                  ourdata = (unsigned char *)malloc(xmax*ymax);
591                  if (ourdata == NULL)
592                          goto fail;
593 <                ourras = make_raster(thedisplay, &ourvis, 8, ourdata,
593 >                ourras = make_raster(thedisplay, &ourvis, 8, (char *)ourdata,
594                                  xmax, ymax, 8);
595                  if (ourras == NULL)
596                          goto fail;
# Line 970 | Line 973 | avgbox(                                /* average color over current bbox */
973          register int    rval;
974  
975          setcolor(cavg, 0., 0., 0.);
976 <        rval = dobox(colavg, (char *)cavg);
976 >        rval = dobox(colavg, (void *)cavg);
977          if (rval > 0) {
978                  d = 1./rval;
979                  scalecolor(cavg, d);
# Line 1018 | Line 1021 | static void
1021   addfix(                 /* add fixation points to histogram */
1022          COLR    *scn,
1023          int     n,
1024 <        void    *p  /*NOTUSED*/
1024 >        void    *p
1025   )
1026   {
1027 <        if (tmCvColrs(lscan, TM_NOCHROM, scn, n))
1027 >        TMstruct *      tms = (TMstruct *)p;
1028 >        
1029 >        if (tmCvColrs(tms, lscan, TM_NOCHROM, scn, n))
1030                  goto tmerr;
1031 <        if (tmAddHisto(lscan, n, FIXWEIGHT))
1031 >        if (tmAddHisto(tms, lscan, n, FIXWEIGHT))
1032                  goto tmerr;
1033          return;
1034   tmerr:
# Line 1047 | Line 1052 | make_tonemap(void)                     /* initialize tone mapping */
1052          }
1053          flags = tmflags;                /* histogram adjustment */
1054          if (greyscale) flags |= TM_F_BW;
1055 <        if (tmTop != NULL) {            /* reuse old histogram if one */
1056 <                tmDone(tmTop);
1057 <                tmTop->flags = flags;
1055 >        if (tmGlobal != NULL) {         /* reuse old histogram if one */
1056 >                tmDone(tmCurrent); tmCurrent = NULL;
1057 >                tmGlobal->flags = flags;
1058          } else {                        /* else initialize */
1059                  if ((lscan = (TMbright *)malloc(xmax*sizeof(TMbright))) == NULL)
1060                          goto memerr;
# Line 1061 | Line 1066 | make_tonemap(void)                     /* initialize tone mapping */
1066                                  == NULL)
1067                          goto memerr;
1068                                                  /* initialize tm library */
1069 <                if (tmInit(flags, stdprims, gamcor) == NULL)
1069 >                tmGlobal = tmInit(flags, stdprims, gamcor);
1070 >                if (tmGlobal == NULL)
1071                          goto memerr;
1072 <                if (tmSetSpace(stdprims, WHTEFFICACY/exposure))
1072 >                if (tmSetSpace(tmGlobal, stdprims, WHTEFFICACY/exposure, NULL))
1073                          goto tmerr;
1074                                                  /* compute picture histogram */
1075                  for (y = 0; y < ymax; y++) {
1076                          getscan(y);
1077 <                        if (tmCvColrs(lscan, TM_NOCHROM, scanline, xmax))
1077 >                        if (tmCvColrs(tmGlobal, lscan, TM_NOCHROM,
1078 >                                        scanline, xmax))
1079                                  goto tmerr;
1080 <                        if (tmAddHisto(lscan, xmax, 1))
1080 >                        if (tmAddHisto(tmGlobal, lscan, xmax, 1))
1081                                  goto tmerr;
1082                  }
1083          }
1084 <        tmDup();                        /* add fixations to duplicate map */
1085 <        dobox(addfix, NULL);
1084 >        tmCurrent = tmDup(tmGlobal);    /* add fixations to duplicate map */
1085 >        dobox(addfix, (void *)tmCurrent);
1086                                          /* (re)compute tone mapping */
1087 <        if (tmComputeMapping(gamcor, 0., 0.))
1087 >        if (tmComputeMapping(tmCurrent, gamcor, 0., 0.))
1088                  goto tmerr;
1089          return;
1090   memerr:
# Line 1103 | Line 1110 | tmap_colrs(            /* apply tone mapping to scanline */
1110          }
1111          if (len > xmax)
1112                  quiterr("code error 1 in tmap_colrs");
1113 <        if (tmCvColrs(lscan, cscan, scn, len))
1113 >        if (tmCvColrs(tmCurrent, lscan, cscan, scn, len))
1114                  goto tmerr;
1115 <        if (tmMapPixels(pscan, lscan, cscan, len))
1115 >        if (tmMapPixels(tmCurrent, pscan, lscan, cscan, len))
1116                  goto tmerr;
1117          ps = pscan;
1118          if (greyscale)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines