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 |
501 |
|
|
502 |
|
// Shift render bar area the specified amount down the frame |
503 |
|
bool |
504 |
< |
RpictSimulManager::LowerBar(int v) |
504 |
> |
RpictSimulManager::LowerBar(int v, int ytop) |
505 |
|
{ |
506 |
– |
if (v <= 0) return !v; |
506 |
|
if (!barPix | !barDepth | (v > THeight()) | !tvw.type) |
507 |
|
return false; |
508 |
+ |
if (v <= 0) return !v; |
509 |
+ |
if ((ytop -= v) <= 0) |
510 |
+ |
return true; |
511 |
|
tvw.voff -= double(v)/THeight(); |
512 |
|
ptvw.voff -= double(v)/THeight(); |
513 |
|
if (v == THeight()) { |
520 |
|
sizeof(COLORV)*NC*TWidth()*(THeight()-v)); |
521 |
|
memmove(barDepth, barDepth + TWidth()*v, |
522 |
|
sizeof(float)*TWidth()*(THeight()-v)); |
523 |
+ |
if (ytop < THeight()) { // mark what we won't do as finished |
524 |
+ |
doneMap.ClearRect(0, 0, TWidth(), THeight()-ytop, true); |
525 |
+ |
memset(barPix, 0, sizeof(COLORV)*NC*TWidth()*(THeight()-ytop)); |
526 |
+ |
memset(barDepth, 0, sizeof(float)*TWidth()*(THeight()-ytop)); |
527 |
+ |
} |
528 |
|
return true; |
529 |
|
} |
530 |
|
|
566 |
|
} |
567 |
|
int lastOut = ytop; // render down frame |
568 |
|
while (ytop > 0) { |
569 |
< |
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); |
569 |
> |
// fprintf(stderr, "At y=%d, source drawing %s...\n", ytop, parr ? "ON" : "OFF"); |
570 |
|
if (prCB) |
571 |
|
(*prCB)(100.*(GetHeight()-ytop)/GetHeight()); |
572 |
|
if (!RenderRect()) // render this bar |
617 |
|
if (fflush(pfp) == EOF || (dfp && fflush(dfp) == EOF)) |
618 |
|
error(SYSTEM, "output write error"); |
619 |
|
// advance down the frame |
620 |
< |
if (lastOut > 0 && !LowerBar(vstep)) |
620 |
> |
if (lastOut > 0 && !LowerBar(vstep, ytop)) |
621 |
|
return false; |
622 |
|
ytop -= vstep; |
623 |
|
} |