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

Comparing ray/src/util/rmatrix.c (file contents):
Revision 2.72 by greg, Tue Dec 5 21:45:39 2023 UTC vs.
Revision 2.73 by greg, Wed Dec 6 17:57:34 2023 UTC

# Line 668 | Line 668 | rmx_copy(const RMATRIX *rm)
668          return(dnew);
669   }
670  
671 + /* Replace data in first matrix with data from second */
672 + int
673 + rmx_transfer_data(RMATRIX *rdst, RMATRIX *rsrc, int dometa)
674 + {
675 +        if (!rdst | !rsrc || (rdst->nrows != rsrc->nrows) |
676 +                        (rdst->ncols != rsrc->ncols) |
677 +                        (rdst->ncomp != rsrc->ncomp))
678 +                return(0);
679 +
680 +        if (dometa) {           /* transfer everything? */
681 +                rmx_reset(rdst);
682 +                *rdst = *rsrc;
683 +                rsrc->info = NULL; rsrc->mapped = NULL; rsrc->mtx = NULL;
684 +                return(1);
685 +        }
686 +        if (rdst->mapped)
687 +                return(0);      /* XXX can't handle this case */
688 +                                /* just matrix data -- leave metadata */
689 +        if (rdst->mtx) free(rdst->mtx);
690 +        rdst->mtx = rsrc->mtx;
691 +        rsrc->mtx = NULL;
692 +        return(1);
693 + }
694 +
695   /* Allocate and assign transposed matrix */
696   RMATRIX *
697   rmx_transpose(const RMATRIX *rm)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines