| 482 | 
  | 
        for (ti[1] = 0; ti[1] < tileGrid[1]; ti[1]++) | 
| 483 | 
  | 
                for (ti[0] = 0; ti[0] < tileGrid[0]; ti[0]++) | 
| 484 | 
  | 
                        cnt += renderable_tile(tile_p(ti)); | 
| 485 | 
< | 
        if (!cnt) {                     // nothing left to do? | 
| 486 | 
< | 
                error(WARNING, "output appears to be complete, nothing added"); | 
| 487 | 
< | 
                return true; | 
| 488 | 
< | 
        } | 
| 485 | 
> | 
        if (!cnt) | 
| 486 | 
> | 
                return false;           // parent can do nothing | 
| 487 | 
  | 
        if (cnt < nproc) { | 
| 488 | 
  | 
                sprintf(errmsg, "only %d renderable tiles, reducing process count", cnt); | 
| 489 | 
  | 
                error(WARNING, errmsg); | 
| 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); | 
| 608 | 
  | 
                if (!fscnresolu(&hresolu, &vresolu, pdfp[0])) | 
| 609 | 
  | 
                        error(USER, "missing picture resolution"); | 
| 610 | 
+ | 
                pixaspect = .0;                 // need to leave this as is | 
| 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); | 
| 614 | 
< | 
                        error(USER, errmsg); | 
| 615 | 
< | 
                } | 
| 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 | 
| 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); | 
| 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); | 
| 682 | 
  | 
        if (children_finished())                // work done in children? | 
| 683 | 
  | 
                return dt; | 
| 684 | 
  | 
 | 
| 685 | 
< | 
        int     ti[2];                          // else render tiles | 
| 685 | 
> | 
        int     ndone = 0;                      // else render tiles | 
| 686 | 
> | 
        int     ti[2]; | 
| 687 | 
  | 
        while (nexttile(ti)) { | 
| 688 | 
  | 
                const int       offset = (tileGrid[1]-1-ti[1])*myRPmanager.GetWidth()*myRPmanager.THeight() + | 
| 689 | 
  | 
                                                (myRPmanager.THeight()-1)*myRPmanager.GetWidth() + | 
| 715 | 
  | 
                        error(USER, errmsg); | 
| 716 | 
  | 
                } | 
| 717 | 
  | 
                tile_p(ti)->status = 1;         // mark tile completed | 
| 718 | 
+ | 
                ndone++; | 
| 719 | 
  | 
        } | 
| 720 | 
+ | 
        if (!ndone) | 
| 721 | 
+ | 
                error(WARNING, "no tiles need rendering, exit"); | 
| 722 | 
  | 
        /* | 
| 723 | 
  | 
        munmap(pixMap, pmlen);                  // technically unnecessary... | 
| 724 | 
  | 
        if (zdMap) munmap(zdMap, zmlen); |