ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rxpiece.cpp
(Generate patch)

Comparing ray/src/rt/rxpiece.cpp (file contents):
Revision 2.3 by greg, Tue Sep 17 00:25:41 2024 UTC vs.
Revision 2.4 by greg, Tue Sep 17 02:24:18 2024 UTC

# Line 598 | Line 598 | rpiece(char *pout, RenderDataType dt, char *zout)
598  
599          const bool      newOutput = (access(pout, F_OK) < 0);
600          FILE            *pdfp[2];
601 <        if (!newOutput) {                       // output exists?
601 >        if (newOutput) {                        // new output file?
602 >                CHECK((tileGrid[0] <= 1) & (tileGrid[1] <= 1),
603 >                                 USER, "bad tiling specification");
604 >        } else {
605                  dt = myRPmanager.ReopenOutput(pdfp, pout, zout);
606                  if (dt == RDTnone)
607                          quit(1);
# Line 608 | Line 611 | rpiece(char *pout, RenderDataType dt, char *zout)
611                  myRPmanager.NewHeader(pout);    // get prev. header info
612                  const char *    tval = myRPmanager.GetHeadStr("TILED=");
613                  if (tval) sscanf(tval, "%d %d", &tileGrid[0], &tileGrid[1]);
614 <                if (!myRPmanager.GetView()) {
615 <                        sprintf(errmsg, "missing view in picture file '%s'", pout);
613 <                        error(USER, errmsg);
614 <                }
614 >                CHECK(myRPmanager.GetView()==NULL,
615 >                                USER, "missing view in picture file");
616                  ourview = *myRPmanager.GetView();
617          }
618          int     hvdim[2] = {hresolu, vresolu};  // set up tiled frame
# Line 653 | Line 654 | rpiece(char *pout, RenderDataType dt, char *zout)
654          if (pmlen&7) pmlen += 8 - (pmlen&7);    // 8-byte alignment to be safe
655          pmlen += sizeof(TileProg)*tileGrid[0]*tileGrid[1];
656                                                  // map picture file to memory
657 <        if (ftruncate(fileno(pdfp[0]), pmlen) < 0)
657 >        if (newOutput && ftruncate(fileno(pdfp[0]), pmlen) < 0)
658                  error(SYSTEM, "cannot extend picture buffer");
659          uby8 *          pixMap = (uby8 *)mmap(NULL, pmlen, PROT_READ|PROT_WRITE,
660                                                  MAP_SHARED, fileno(pdfp[0]), 0);
# Line 666 | Line 667 | rpiece(char *pout, RenderDataType dt, char *zout)
667          const size_t    zmlen = zdata_beg + zdpSiz*hresolu*vresolu;
668          uby8 *          zdMap = NULL;
669          if (RDTdepthT(dt)) {
670 <                if (ftruncate(fileno(pdfp[1]), zmlen) < 0)
670 >                if (newOutput && ftruncate(fileno(pdfp[1]), zmlen) < 0)
671                          error(SYSTEM, "cannot extend depth buffer");
672                  zdMap = (uby8 *)mmap(NULL, zmlen, PROT_READ|PROT_WRITE,
673                                                  MAP_SHARED, fileno(pdfp[1]), 0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines