Rev 76 | Rev 106 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 76 | Rev 94 | ||
---|---|---|---|
Line 16... | Line 16... | ||
16 | along with this program; if not, write to the Free Software |
16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ |
18 | */ |
19 | 19 | ||
20 | #include "ff.h" |
20 | #include "ff.h" |
- | 21 | ||
21 | #include "symtab.h" |
22 | #include "symtab.h" |
22 | #include "node.h" |
23 | #include "node.h" |
23 | #include "funcs.h" |
24 | #include "funcs.h" |
24 | #include "y.tab.h" |
25 | #include "y.tab.h" |
25 | 26 | ||
26 | extern value_type var[]; |
27 | extern value_type var[]; |
27 | extern int nplanes,varused[],cnvused,srcradused; |
28 | extern int nplanes,varused[],cnvused; |
28 | extern struct node *tree[]; |
29 | extern struct node *tree[]; |
29 | 30 | ||
30 | // points to first row, first column of selection image data |
31 | // points to first row, first column of selection image data |
31 | // this is used by src() and cnv() functions to access pixels |
32 | // this is used by src() and cnv() functions to access pixels |
32 | unsigned char *image_ptr; |
33 | unsigned char *image_ptr; |
Line 36... | Line 37... | ||
36 | /* get prepared to evaluate expression trees-- |
37 | /* get prepared to evaluate expression trees-- |
37 | this assumes that tree[] array is already set up |
38 | this assumes that tree[] array is already set up |
38 | return TRUE if we're ready to go |
39 | return TRUE if we're ready to go |
39 | */ |
40 | */ |
40 | 41 | ||
- | 42 | // minimum setup required when formulae have not changed, |
|
- | 43 | // and a new preview is to be generated. (Called by recalc_preview()) |
|
- | 44 | void evalinit(){ |
|
- | 45 | INITRANDSEED(); |
|
- | 46 | } |
|
- | 47 | ||
- | 48 | // full setup for evaluation, called when formulae have changed. |
|
41 | Boolean setup(FilterRecordPtr pb){ |
49 | Boolean setup(FilterRecordPtr pb){ |
42 | int i; |
50 | int i; |
43 | 51 | ||
44 | INITRANDSEED(); |
- | |
45 | var['X'] = pb->filterRect.right - pb->filterRect.left; |
52 | var['X'] = pb->filterRect.right - pb->filterRect.left; |
46 | var['Y'] = pb->filterRect.bottom - pb->filterRect.top; |
53 | var['Y'] = pb->filterRect.bottom - pb->filterRect.top; |
47 | var['Z'] = nplanes; |
54 | var['Z'] = nplanes; |
48 | var['D'] = 1024; |
55 | var['D'] = 1024; |
49 | var['M'] = ff_c2m(var['X'],var['Y'])/2; |
56 | var['M'] = ff_c2m(var['X'],var['Y'])/2; |
50 | 57 | ||
51 | /* initialise flags for tracking special variable usage */ |
58 | /* initialise flags for tracking special variable usage */ |
52 | for(i = 0; i < 0x100; i++) |
59 | for(i = 0; i < 0x100; i++) |
53 | varused[i] = 0; |
60 | varused[i] = 0; |
54 | srcradused = cnvused = 0; |
61 | needall = cnvused = 0; |
55 | for(i = 0; i < nplanes; ++i){ |
62 | for(i = 0; i < nplanes; ++i){ |
56 | //char s[100];sprintf(s,"expr[%d]=%#x",i,expr[i]);dbg(s); |
63 | //char s[100];sprintf(s,"expr[%d]=%#x",i,expr[i]);dbg(s); |
57 | if( tree[i] || (tree[i] = parseexpr(expr[i])) ) |
64 | if( tree[i] || (tree[i] = parseexpr(expr[i])) ) |
58 | checkvars(tree[i],varused,&cnvused,&srcradused); |
65 | checkvars(tree[i],varused,&cnvused,&needall); |
59 | else |
66 | else |
60 | break; |
67 | break; |
61 | } |
68 | } |
62 | needinput = ( cnvused || srcradused |
69 | needinput = ( cnvused || needall |
63 | || varused['r'] || varused['g'] || varused['b'] || varused['a'] |
70 | || varused['r'] || varused['g'] || varused['b'] || varused['a'] |
64 | || varused['i'] || varused['u'] || varused['v'] || varused['c'] ); |
71 | || varused['i'] || varused['u'] || varused['v'] || varused['c'] ); |
65 | 72 | ||
- | 73 | evalinit(); |
|
66 | return i==nplanes; /* all required expressions parse OK */ |
74 | return i==nplanes; /* all required expressions parse OK */ |
67 | } |
75 | } |
68 | 76 | ||
69 | void evalpixel(unsigned char *outp,unsigned char *inp){ |
77 | void evalpixel(unsigned char *outp,unsigned char *inp){ |
70 | int f,k; |
78 | int f,k; |