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

Comparing src/util/rmatrix.c (file contents):
Revision 2.102 by greg, Thu Oct 30 16:47:54 2025 UTC vs.
Revision 2.103 by greg, Thu Oct 30 17:26:45 2025 UTC

# Line 255 | Line 255 | rmx_load_double(rmx_dtype *drp, const RMATRIX *rm, FIL
255          return(1);
256   }
257  
258 static int
259 rmx_load_rgbe(rmx_dtype *drp, const RMATRIX *rm, FILE *fp)
260 {
261        COLR    *scan;
262        COLOR   col;
263        int     j;
264
265        if (rm->ncomp != 3)
266                return(0);
267        scan = (COLR *)tempbuffer(sizeof(COLR)*rm->ncols);
268        if (!scan)
269                return(0);
270        if (freadcolrs(scan, rm->ncols, fp) < 0)
271                return(0);
272        for (j = 0; j < rm->ncols; j++) {
273                colr_color(col, scan[j]);
274                *drp++ = colval(col,RED);
275                *drp++ = colval(col,GRN);
276                *drp++ = colval(col,BLU);
277        }
278        return(1);
279 }
280
258   #if DTrmx_native==DTfloat
259 < static int
283 < rmx_load_spec(rmx_dtype *drp, const RMATRIX *rm, FILE *fp)
284 < {
285 <        COLRV   *scan;
286 <        int     j;
287 <
288 <        if ((rm->ncomp < 3) | (rm->ncomp > MAXCOMP))
289 <                return(0);
290 <        scan = (COLRV *)tempbuffer((rm->ncomp+1)*rm->ncols);
291 <        if (!scan)
292 <                return(0);
293 <        if (freadscolrs(scan, rm->ncomp, rm->ncols, fp) < 0)
294 <                return(0);
295 <        for (j = 0; j < rm->ncols; j++, drp += rm->ncomp)
296 <                scolr2scolor(drp, scan+j*(rm->ncomp+1), rm->ncomp);
297 <        return(1);
298 < }
259 > #define rmx_load_spec(dp,rm,fp) (freadsscan(dp,(rm)->ncomp,(rm)->ncols,fp) >= 0)
260   #else
261   static int
262   rmx_load_spec(rmx_dtype *drp, const RMATRIX *rm, FILE *fp)
# Line 365 | Line 326 | rmx_load_row(rmx_dtype *drp, const RMATRIX *rm, FILE *
326                  return(rmx_load_double(drp, rm, fp));
327          case DTrgbe:
328          case DTxyze:
368                return(rmx_load_rgbe(drp, rm, fp));
329          case DTspec:
330                  return(rmx_load_spec(drp, rm, fp));
331          default:
# Line 539 | Line 499 | rmx_write_rgbe(const rmx_dtype *dp, int ncomp, int len
499   }
500  
501   #if DTrmx_native==DTfloat
502 < static int
543 < rmx_write_spec(const rmx_dtype *dp, int ncomp, int len, FILE *fp)
544 < {
545 <        COLRV   *scan;
546 <        int     j;
547 <
548 <        if ((ncomp < 3) | (ncomp > MAXCOMP)) return(0);
549 <        scan = (COLRV *)tempbuffer((ncomp+1)*len);
550 <        if (!scan) return(0);
551 <        for (j = 0; j < len; j++, dp += ncomp)
552 <                scolor2scolr(scan+j*(ncomp+1), dp, ncomp);
553 <
554 <        return(fwritescolrs(scan, ncomp, len, fp) >= 0);
555 < }
502 > #define rmx_write_spec(dp,nc,ln,fp)     (fwritesscan(dp,nc,ln,fp) >= 0)
503   #else
504   static int
505   rmx_write_spec(const rmx_dtype *dp, int ncomp, int len, FILE *fp)

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)