diff options
author | rodri <rgl@antares-labs.eu> | 2024-08-31 17:42:51 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-08-31 17:42:51 +0000 |
commit | 8f04e0363dc8ec90dcc5da3e7b131c800f25879a (patch) | |
tree | 0b45eca006a5fdd7d62610b4dc14839af8012ef6 | |
parent | c4be6b6604962376c810fb2eace384e82b67b44c (diff) | |
download | libgraphics-8f04e0363dc8ec90dcc5da3e7b131c800f25879a.tar.gz libgraphics-8f04e0363dc8ec90dcc5da3e7b131c800f25879a.tar.bz2 libgraphics-8f04e0363dc8ec90dcc5da3e7b131c800f25879a.zip |
render: remove pointless for-loop.
-rw-r--r-- | render.c | 49 |
1 files changed, 25 insertions, 24 deletions
@@ -471,32 +471,33 @@ tilerdurden(void *arg) p = cp; } - for(; np--; p++){ - p->v[0].p = clip2ndc(p->v[0].p); - p->v[1].p = clip2ndc(p->v[1].p); - p->v[0].p = ndc2viewport(params->fb, p->v[0].p); - p->v[1].p = ndc2viewport(params->fb, p->v[1].p); + if(np < 1) + break; - bbox.min.x = min(p->v[0].p.x, p->v[1].p.x); - bbox.min.y = min(p->v[0].p.y, p->v[1].p.y); - bbox.max.x = max(p->v[0].p.x, p->v[1].p.x)+1; - bbox.max.y = max(p->v[0].p.y, p->v[1].p.y)+1; + p->v[0].p = clip2ndc(p->v[0].p); + p->v[1].p = clip2ndc(p->v[1].p); + p->v[0].p = ndc2viewport(params->fb, p->v[0].p); + p->v[1].p = ndc2viewport(params->fb, p->v[1].p); - for(i = 0; i < nproc; i++) - if(rectXrect(bbox,wr[i])){ - newparams = emalloc(sizeof *newparams); - *newparams = *params; - task = emalloc(sizeof *task); - task->params = newparams; - task->wr = wr[i]; - task->p = *p; - task->p.v[0] = dupvertex(&p->v[0]); - task->p.v[1] = dupvertex(&p->v[1]); - sendp(taskchans[i], task); - } - delvattrs(&p->v[0]); - delvattrs(&p->v[1]); - } + bbox.min.x = min(p->v[0].p.x, p->v[1].p.x); + bbox.min.y = min(p->v[0].p.y, p->v[1].p.y); + bbox.max.x = max(p->v[0].p.x, p->v[1].p.x)+1; + bbox.max.y = max(p->v[0].p.y, p->v[1].p.y)+1; + + for(i = 0; i < nproc; i++) + if(rectXrect(bbox,wr[i])){ + newparams = emalloc(sizeof *newparams); + *newparams = *params; + task = emalloc(sizeof *task); + task->params = newparams; + task->wr = wr[i]; + task->p = *p; + task->p.v[0] = dupvertex(&p->v[0]); + task->p.v[1] = dupvertex(&p->v[1]); + sendp(taskchans[i], task); + } + delvattrs(&p->v[0]); + delvattrs(&p->v[1]); break; case PTriangle: for(i = 0; i < 3; i++){ |