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.60 by greg, Tue Nov 21 01:30:20 2023 UTC vs.
Revision 2.61 by greg, Mon Nov 27 22:04:45 2023 UTC

# Line 507 | Line 507 | rmx_write_rgbe(const RMATRIX *rm, FILE *fp)
507   static int
508   rmx_write_spec(const RMATRIX *rm, FILE *fp)
509   {
510        int     prevNCSAMP = NCSAMP;
510          uby8    *scan = (uby8 *)malloc((rm->ncomp+1)*rm->ncols);
511          int     ok = 1;
512          SCOLOR  scol;
# Line 515 | Line 514 | rmx_write_spec(const RMATRIX *rm, FILE *fp)
514  
515          if (!scan)
516                  return(0);
518        NCSAMP = rm->ncomp;             /* XXX: kosher? */
517          for (i = 0; i < rm->nrows; i++) {
518              for (j = rm->ncols; j--; ) {
519                  const double    *dp = rmx_lval(rm,i,j);
520 <                for (k = NCSAMP; k--; )
520 >                for (k = rm->ncomp; k--; )
521                          scol[k] = dp[k];
522 <                scolor2scolr(scan+j*(NCSAMP+1), scol, NCSAMP);
522 >                scolor2scolr(scan+j*(rm->ncomp+1), scol, rm->ncomp);
523              }
524 <            if (fwritescolrs(scan, rm->ncols, fp) < 0) {
524 >            if (fwritescolrs(scan, rm->ncomp, rm->ncols, fp) < 0) {
525                  ok = 0;
526                  break;
527              }
528          }
529          free(scan);
532        NCSAMP = prevNCSAMP;
530          return(ok);
531   }
532  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines