| 13 |
|
#include <ctype.h> |
| 14 |
|
|
| 15 |
|
#include "ray.h" |
| 16 |
+ |
#include "paths.h" |
| 17 |
|
#include "rpaint.h" |
| 18 |
|
|
| 19 |
|
#define CTRL(c) ((c)-'@') |
| 23 |
|
quit(code) /* quit program */ |
| 24 |
|
int code; |
| 25 |
|
{ |
| 25 |
– |
#ifdef MSTATS |
| 26 |
– |
if (code == 2 && errno == ENOMEM) |
| 27 |
– |
printmemstats(stderr); |
| 28 |
– |
#endif |
| 26 |
|
if (ray_pnprocs > 0) /* close children if any */ |
| 27 |
< |
ray_pclose(0); |
| 28 |
< |
devclose(); |
| 27 |
> |
ray_pclose(0); |
| 28 |
> |
if (!ray_pnprocs) /* in parent */ |
| 29 |
> |
devclose(); |
| 30 |
|
exit(code); |
| 31 |
|
} |
| 32 |
|
|
| 36 |
|
char *dname |
| 37 |
|
) |
| 38 |
|
{ |
| 39 |
< |
extern char *progname, *octname; |
| 39 |
> |
extern char *octname; |
| 40 |
|
char *id; |
| 41 |
|
int i; |
| 42 |
|
|
| 190 |
|
break; |
| 191 |
|
case 'm': /* move camera (or memstats) */ |
| 192 |
|
if (badcom("move")) |
| 195 |
– |
#ifdef MSTATS |
| 196 |
– |
{ |
| 197 |
– |
if (badcom("memory")) |
| 198 |
– |
goto commerr; |
| 199 |
– |
printmemstats(stderr); |
| 200 |
– |
break; |
| 201 |
– |
} |
| 202 |
– |
#else |
| 193 |
|
goto commerr; |
| 204 |
– |
#endif |
| 194 |
|
getmove(args); |
| 195 |
|
break; |
| 196 |
|
case 'r': /* rotate/repaint */ |
| 214 |
|
} |
| 215 |
|
getpivot(args); |
| 216 |
|
break; |
| 217 |
+ |
case 'o': /* origin view */ |
| 218 |
+ |
if (badcom("origin")) |
| 219 |
+ |
goto commerr; |
| 220 |
+ |
getorigin(args); |
| 221 |
+ |
break; |
| 222 |
|
case CTRL('R'): /* redraw */ |
| 223 |
|
redraw(); |
| 224 |
|
break; |
| 255 |
|
error(COMMAND, errmsg); |
| 256 |
|
break; |
| 257 |
|
} |
| 258 |
+ |
if (newparam && ray_pnprocs) /* drop into immediate mode */ |
| 259 |
+ |
ray_pclose(0); |
| 260 |
|
#undef badcom |
| 261 |
|
} |
| 262 |
|
|
| 291 |
|
/* sample the image */ |
| 292 |
|
for (y = 0; /* y < ysiz */ ; y++) { |
| 293 |
|
for (x = 0; x < xsiz-1; x++) { |
| 294 |
< |
if (dev->inpready || errno == ENOMEM) |
| 294 |
> |
if (dev->inpready) |
| 295 |
|
goto escape; |
| 296 |
|
/* |
| 297 |
|
* Test super-pixel to the right. |
| 305 |
|
if (y >= ysiz-1) |
| 306 |
|
break; |
| 307 |
|
for (x = 0; x < xsiz; x++) { |
| 308 |
< |
if (dev->inpready || errno == ENOMEM) |
| 308 |
> |
if (dev->inpready) |
| 309 |
|
goto escape; |
| 310 |
|
/* |
| 311 |
|
* Find super-pixel at this position in next row. |
| 339 |
|
{ |
| 340 |
|
int growth; |
| 341 |
|
int mx, my; |
| 346 |
– |
int i; |
| 342 |
|
|
| 343 |
|
if (dev->inpready) /* quit for input */ |
| 344 |
|
return(0); |