| 359 |
|
int sp2 = ceil(log2((TWidth()>THeight() ? TWidth() : THeight()) - 1.)); |
| 360 |
|
int layer = 0; |
| 361 |
|
int x, y; |
| 362 |
< |
fprintf(stderr, "Rendering %dx%d tile with psample=%d, maxdiff=%.3f ...\n", |
| 363 |
< |
TWidth(), THeight(), psample, maxdiff); |
| 362 |
> |
// fprintf(stderr, "Rendering %dx%d tile with psample=%d, maxdiff=%.3f ...\n", |
| 363 |
> |
// TWidth(), THeight(), psample, maxdiff); |
| 364 |
|
while (sp2 > 0) { |
| 365 |
|
ABitMap2 sampMap(TWidth(), THeight()); |
| 366 |
|
int noff[4][2]; |
| 394 |
|
if (!ComputePixel(x, y)) |
| 395 |
|
return false; |
| 396 |
|
doneSamples |= sampMap; // samples now done or at least queued |
| 397 |
< |
fprintf(stderr, "Sampled %ld pixels at (sp2,layer)=(%d,%d)\n", |
| 398 |
< |
(long)sampMap.SumTotal(), sp2, layer); |
| 399 |
< |
fprintf(stderr, "\t%ld pixels (%.3f%%) completed (+%ld in process)\n", |
| 400 |
< |
(long)doneMap.SumTotal(), 100.*doneMap.SumTotal()/doneMap.Width()/doneMap.Height(), |
| 401 |
< |
(long)(doneSamples.SumTotal()-doneMap.SumTotal())); |
| 397 |
> |
// fprintf(stderr, "Sampled %ld pixels at (sp2,layer)=(%d,%d)\n", |
| 398 |
> |
// (long)sampMap.SumTotal(), sp2, layer); |
| 399 |
> |
// fprintf(stderr, "\t%ld pixels (%.3f%%) completed (+%ld in process)\n", |
| 400 |
> |
// (long)doneMap.SumTotal(), 100.*doneMap.SumTotal()/doneMap.Width()/doneMap.Height(), |
| 401 |
> |
// (long)(doneSamples.SumTotal()-doneMap.SumTotal())); |
| 402 |
|
sp2 -= layer++ & 1; // next denser sampling |
| 403 |
|
} |
| 404 |
|
if (FlushQueue() < 0) // make sure we got everyone |
| 471 |
|
return SetTile(tile) && RenderRect(); |
| 472 |
|
} |
| 473 |
|
|
| 474 |
+ |
// Back to float color with 16-bit depth |
| 475 |
+ |
bool |
| 476 |
+ |
RpictSimulManager::RenderTile(COLORV *rp, int ystride, short *dp, const int *tile) |
| 477 |
+ |
{ |
| 478 |
+ |
if (!rp | (GetWidth() <= 0) | (GetHeight() <= 0) | !vw.type) |
| 479 |
+ |
return false; |
| 480 |
+ |
if (!ystride) // contiguous rows? |
| 481 |
+ |
ystride = TWidth(); |
| 482 |
+ |
pacc.Init(rp, ystride, dp); |
| 483 |
+ |
if (prims == xyzprims) |
| 484 |
+ |
pacc.SetColorSpace(RDTxyz); |
| 485 |
+ |
else if (prims) |
| 486 |
+ |
pacc.SetColorSpace(RDTrgb, prims); |
| 487 |
+ |
|
| 488 |
+ |
return SetTile(tile) && RenderRect(); |
| 489 |
+ |
} |
| 490 |
+ |
|
| 491 |
|
// Allocate a new render bar |
| 492 |
|
void |
| 493 |
|
RpictSimulManager::NewBar(int ht) |
| 518 |
|
|
| 519 |
|
// Shift render bar area the specified amount down the frame |
| 520 |
|
bool |
| 521 |
< |
RpictSimulManager::LowerBar(int v) |
| 521 |
> |
RpictSimulManager::LowerBar(int v, int ytop) |
| 522 |
|
{ |
| 506 |
– |
if (v <= 0) return !v; |
| 523 |
|
if (!barPix | !barDepth | (v > THeight()) | !tvw.type) |
| 524 |
|
return false; |
| 525 |
+ |
if (v <= 0) return !v; |
| 526 |
+ |
if ((ytop -= v) <= 0) |
| 527 |
+ |
return true; |
| 528 |
|
tvw.voff -= double(v)/THeight(); |
| 529 |
|
ptvw.voff -= double(v)/THeight(); |
| 530 |
|
if (v == THeight()) { |
| 537 |
|
sizeof(COLORV)*NC*TWidth()*(THeight()-v)); |
| 538 |
|
memmove(barDepth, barDepth + TWidth()*v, |
| 539 |
|
sizeof(float)*TWidth()*(THeight()-v)); |
| 540 |
+ |
if (ytop < THeight()) { // mark what we won't do as finished |
| 541 |
+ |
doneMap.ClearRect(0, 0, TWidth(), THeight()-ytop, true); |
| 542 |
+ |
memset(barPix, 0, sizeof(COLORV)*NC*TWidth()*(THeight()-ytop)); |
| 543 |
+ |
memset(barDepth, 0, sizeof(float)*TWidth()*(THeight()-ytop)); |
| 544 |
+ |
} |
| 545 |
|
return true; |
| 546 |
|
} |
| 547 |
|
|
| 583 |
|
} |
| 584 |
|
int lastOut = ytop; // render down frame |
| 585 |
|
while (ytop > 0) { |
| 586 |
< |
fprintf(stderr, "At y=%d, source drawing %s...\n", ytop, parr ? "ON" : "OFF"); |
| 563 |
< |
if (ytop < THeight()) // mark what we won't do as finished |
| 564 |
< |
doneMap.ClearRect(0, 0, TWidth(), THeight()-ytop, true); |
| 586 |
> |
// fprintf(stderr, "At y=%d, source drawing %s...\n", ytop, parr ? "ON" : "OFF"); |
| 587 |
|
if (prCB) |
| 588 |
|
(*prCB)(100.*(GetHeight()-ytop)/GetHeight()); |
| 589 |
|
if (!RenderRect()) // render this bar |
| 634 |
|
if (fflush(pfp) == EOF || (dfp && fflush(dfp) == EOF)) |
| 635 |
|
error(SYSTEM, "output write error"); |
| 636 |
|
// advance down the frame |
| 637 |
< |
if (lastOut > 0 && !LowerBar(vstep)) |
| 637 |
> |
if (lastOut > 0 && !LowerBar(vstep, ytop)) |
| 638 |
|
return false; |
| 639 |
|
ytop -= vstep; |
| 640 |
|
} |