19 |
|
|
20 |
|
|
21 |
|
void |
22 |
+ |
quit(code) /* quit program */ |
23 |
+ |
int code; |
24 |
+ |
{ |
25 |
+ |
if (ray_pnprocs > 0) /* close children if any */ |
26 |
+ |
ray_pclose(0); |
27 |
+ |
if (!ray_pnprocs) /* in parent */ |
28 |
+ |
devclose(); |
29 |
+ |
exit(code); |
30 |
+ |
} |
31 |
+ |
|
32 |
+ |
|
33 |
+ |
void |
34 |
|
devopen( /* open device driver */ |
35 |
|
char *dname |
36 |
|
) |
189 |
|
break; |
190 |
|
case 'm': /* move camera (or memstats) */ |
191 |
|
if (badcom("move")) |
180 |
– |
#ifdef MSTATS |
181 |
– |
{ |
182 |
– |
if (badcom("memory")) |
183 |
– |
goto commerr; |
184 |
– |
printmemstats(stderr); |
185 |
– |
break; |
186 |
– |
} |
187 |
– |
#else |
192 |
|
goto commerr; |
189 |
– |
#endif |
193 |
|
getmove(args); |
194 |
|
break; |
195 |
|
case 'r': /* rotate/repaint */ |
213 |
|
} |
214 |
|
getpivot(args); |
215 |
|
break; |
216 |
+ |
case 'o': /* origin view */ |
217 |
+ |
if (badcom("origin")) |
218 |
+ |
goto commerr; |
219 |
+ |
getorigin(args); |
220 |
+ |
break; |
221 |
|
case CTRL('R'): /* redraw */ |
222 |
|
redraw(); |
223 |
|
break; |
254 |
|
error(COMMAND, errmsg); |
255 |
|
break; |
256 |
|
} |
257 |
+ |
if (newparam && ray_pnprocs) /* drop into immediate mode */ |
258 |
+ |
ray_pclose(0); |
259 |
|
#undef badcom |
260 |
|
} |
261 |
|
|
290 |
|
/* sample the image */ |
291 |
|
for (y = 0; /* y < ysiz */ ; y++) { |
292 |
|
for (x = 0; x < xsiz-1; x++) { |
293 |
< |
if (dev->inpready || errno == ENOMEM) |
293 |
> |
if (dev->inpready) |
294 |
|
goto escape; |
295 |
|
/* |
296 |
|
* Test super-pixel to the right. |
304 |
|
if (y >= ysiz-1) |
305 |
|
break; |
306 |
|
for (x = 0; x < xsiz; x++) { |
307 |
< |
if (dev->inpready || errno == ENOMEM) |
307 |
> |
if (dev->inpready) |
308 |
|
goto escape; |
309 |
|
/* |
310 |
|
* Find super-pixel at this position in next row. |
338 |
|
{ |
339 |
|
int growth; |
340 |
|
int mx, my; |
331 |
– |
int i; |
341 |
|
|
342 |
|
if (dev->inpready) /* quit for input */ |
343 |
|
return(0); |
405 |
|
growth += refine(p->kid+DR, pd-1); |
406 |
|
if (my < pframe.u) |
407 |
|
growth += refine(p->kid+UR, pd-1); |
399 |
– |
} |
400 |
– |
/* recompute sum */ |
401 |
– |
if (growth) { |
402 |
– |
setcolor(p->v, 0.0, 0.0, 0.0); |
403 |
– |
for (i = 0; i < 4; i++) |
404 |
– |
addcolor(p->v, p->kid[i].v); |
405 |
– |
scalecolor(p->v, 0.25); |
408 |
|
} |
409 |
|
return(growth); |
410 |
|
} |