34 |
|
static RTREE **twigbundle; /* free twig blocks (NULL term.) */ |
35 |
|
static int nexttwig; /* next free twig */ |
36 |
|
|
37 |
– |
#define ungetleaf(li) (qtL.tl=(li)) /* dangerous if used improperly */ |
37 |
|
|
39 |
– |
|
38 |
|
static RTREE * |
39 |
|
newtwig() /* allocate a twig */ |
40 |
|
{ |
87 |
|
} |
88 |
|
|
89 |
|
|
92 |
– |
static int |
93 |
– |
newleaf() /* allocate a leaf from our pile */ |
94 |
– |
{ |
95 |
– |
int li; |
96 |
– |
|
97 |
– |
li = qtL.tl++; |
98 |
– |
if (qtL.tl >= qtL.nl) /* get next leaf in ring */ |
99 |
– |
qtL.tl = 0; |
100 |
– |
if (qtL.tl == qtL.bl) /* need to shake some free */ |
101 |
– |
qtCompost(LFREEPCT); |
102 |
– |
return(li); |
103 |
– |
} |
104 |
– |
|
105 |
– |
|
90 |
|
#define LEAFSIZ (3*sizeof(float)+sizeof(int4)+\ |
91 |
|
sizeof(TMbright)+6*sizeof(BYTE)) |
92 |
|
|
312 |
|
{ |
313 |
|
register int li; |
314 |
|
|
315 |
< |
li = newleaf(); |
315 |
> |
li = qtL.tl++; |
316 |
> |
if (qtL.tl >= qtL.nl) /* advance to next leaf in ring */ |
317 |
> |
qtL.tl = 0; |
318 |
> |
if (qtL.tl == qtL.bl) /* need to shake some free */ |
319 |
> |
qtCompost(LFREEPCT); |
320 |
|
VCOPY(qtL.wp[li], p); |
321 |
|
qtL.wd[li] = encodedir(v); |
322 |
|
tmCvColrs(&qtL.brt[li], qtL.chr[li], c, 1); |
323 |
|
if (!addleaf(li)) |
324 |
< |
ungetleaf(li); |
324 |
> |
qtL.tl = li; /* unget this leaf */ |
325 |
|
} |
326 |
|
|
327 |
|
|