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

Comparing ray/src/common/tonemap.c (file contents):
Revision 3.2 by greg, Tue Apr 15 20:04:43 1997 UTC vs.
Revision 3.3 by greg, Wed Apr 16 20:28:03 1997 UTC

# Line 500 | Line 500 | register struct tmStruct       *tms;
500   }
501  
502  
503 + struct tmStruct *
504 + tmDup()                         /* duplicate top tone mapping */
505 + {
506 +        int     len;
507 +        register int    i;
508 +        register struct tmStruct        *tmnew;
509 +
510 +        if (tmTop == NULL)              /* anything to duplicate? */
511 +                return(NULL);
512 +        tmnew = (struct tmStruct *)malloc(sizeof(struct tmStruct));
513 +        if (tmnew == NULL)
514 +                return(NULL);
515 +        *tmnew = *tmTop;                /* copy everything */
516 +        if (tmnew->histo != NULL) {     /* duplicate histogram */
517 +                len = (tmnew->brmax-MINBRT)/HISTEP + 1 -
518 +                                (tmnew->brmin-MINBRT)/HISTEP;
519 +                tmnew->histo = (int *)malloc(len*sizeof(int));
520 +                if (tmnew->histo != NULL)
521 +                        for (i = len; i--; )
522 +                                tmnew->histo[i] = tmTop->histo[i];
523 +        }
524 +        if (tmnew->lumap != NULL) {     /* duplicate luminance mapping */
525 +                len = tmnew->brmax-tmnew->brmin+1;
526 +                tmnew->lumap = (unsigned short *)malloc(
527 +                                                len*sizeof(unsigned short) );
528 +                if (tmnew->lumap != NULL)
529 +                        for (i = len; i--; )
530 +                                tmnew->lumap[i] = tmTop->lumap[i];
531 +        }
532 +        tmnew->tmprev = tmTop;          /* make copy current */
533 +        return(tmTop = tmnew);
534 + }
535 +
536 +
537   int
538   tmPush(tms)                     /* push tone mapping on top of stack */
539   register struct tmStruct        *tms;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines