re->r.actlay= 0;
}
- /* display active layer */
- rr->renlay= render_get_active_layer(re, rr);
-
return rr;
}
{
ListBase threads;
RenderPart *pa, *nextpa;
- int maxthreads, rendering=1, counter= 1, hasdrawn, drawtimer=0;
+ int maxthreads, rendering=1, counter= 1, drawtimer=0;
if(re->result==NULL)
return;
while(rendering) {
if(nextpa && BLI_available_threads(&threads) && !re->test_break()) {
+ drawtimer= 0;
nextpa->nr= counter++; /* for nicest part, and for stats */
nextpa->thread= BLI_available_thread_index(&threads); /* sample index */
BLI_insert_thread(&threads, nextpa);
}
/* check for ready ones to display, and if we need to continue */
- hasdrawn= 0;
rendering= 0;
for(pa= re->parts.first; pa; pa= pa->next) {
if(pa->ready) {
free_render_result(pa->result);
pa->result= NULL;
re->i.partsdone++;
- hasdrawn= 1;
+ drawtimer= 0;
}
}
else {
rendering= 1;
if(pa->nr && pa->result && drawtimer>20) {
re->display_draw(pa->result, &pa->result->renrect);
- hasdrawn= 1;
+ drawtimer= 0;
}
}
}
- if(hasdrawn)
- drawtimer= 0;
-
/* on break, wait for all slots to get freed */
if( (g_break=re->test_break()) && BLI_available_threads(&threads)==maxthreads)
rendering= 0;
/* scanline updates have to be 2 lines behind */
rr->renrect.ymin= 0;
rr->renrect.ymax= -2*crop;
-
+ rr->renlay= rl;
+
for(y=pa->disprect.ymin+crop; y<pa->disprect.ymax-crop; y++, rr->renrect.ymax++) {
rf= rectf;
rd= rectdaps;
if(y&1) if(R.test_break()) break;
}
+ /* disable scanline updating */
+ rr->renlay= NULL;
+
if(R.do_gamma) {
rectf= rl->rectf;
for(y= pa->rectx*pa->recty; y>0; y--, rectf+=4) {
if(R.r.mode & R_EDGE) edgerect= MEM_callocT(sizeof(float)*pa->rectx*pa->recty, "rectedge");
for(rl= rr->layers.first; rl; rl= rl->next) {
- /* indication for scanline updates */
- rr->renlay= rl;
- rr->renrect.ymin=rr->renrect.ymax= 0;
/* initialize pixelstructs */
addpsmain(&psmlist);
if(edgerect) MEM_freeT(edgerect);
/* display active layer */
+ rr->renrect.ymin=rr->renrect.ymax= 0;
rr->renlay= render_get_active_layer(&R, rr);
}
shpi.thread= pa->thread;
for(rl= rr->layers.first; rl; rl= rl->next) {
- /* indication for scanline updates */
- rr->renlay= rl;
- rr->renrect.ymin=rr->renrect.ymax= 0;
/* fill shadepixel info struct */
shpi.lay= rl->lay;
float *fcol= rl->rectf;
int x, y, *rp= pa->rectp, *rz= pa->rectz, offs=0;
+ /* initialize scanline updates for main thread */
+ rr->renrect.ymin= 0;
+ rr->renlay= rl;
+
for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, rz++, rp++, fcol+=4, offs++) {
shadepixel_sky(&shpi, (float)x, (float)y, *rz, *rp, 0);
if(y&1)
if(R.test_break()) break;
}
+
+ /* disable scanline updating */
+ rr->renlay= NULL;
}
}
}
/* display active layer */
+ rr->renrect.ymin=rr->renrect.ymax= 0;
rr->renlay= render_get_active_layer(&R, rr);
MEM_freeT(pa->rectp); pa->rectp= NULL;
/* if renrect argument, we only display scanlines */
if(renrect) {
+ /* if ymax==recty, rendering of layer is ready, we should not draw, other things happen... */
+ if(rr->renlay==NULL || renrect->ymax>=rr->recty)
+ return;
+
ymin= renrect->ymin;
ymax= renrect->ymax-ymin;
- if(ymax<2 || renrect->ymax>=rr->recty) /* if ymax==recty, rendering of layer is ready, we should not draw, other things happen... */
+ if(ymax<2)
return;
renrect->ymin= renrect->ymax;
}